Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
scrayos committed Nov 3, 2024
1 parent f062582 commit a5fd6fe
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 199 deletions.
33 changes: 16 additions & 17 deletions src/test/kotlin/net/scrayos/xenos/client/data/CapeInfoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@ import net.scrayos.xenos.client.utility.toImage
import scrayosnet.xenos.capeResponse
import java.time.Instant

class CapeInfoTest :
ShouldSpec(
{
context("#toResult") {
should("contain original data") {
val response = capeResponse {
bytes = ByteString.copyFrom(resourceAsBytes("/image_test.png"))
timestamp = 60
}
val image = ByteString.copyFrom(resourceAsBytes("/image_test.png")).toImage()
val result = response.toResult()

result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(60)
result.texture shouldBeOfEqualDimensions image
result.texture shouldHaveEqualPixels image
class CapeInfoTest : ShouldSpec() {
init {
context("#toResult") {
should("contain original data") {
val response = capeResponse {
bytes = ByteString.copyFrom(resourceAsBytes("/image_test.png"))
timestamp = 60
}
val image = ByteString.copyFrom(resourceAsBytes("/image_test.png")).toImage()
val result = response.toResult()

result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(60)
result.texture shouldBeOfEqualDimensions image
result.texture shouldHaveEqualPixels image
}
},
)
}
}
}
37 changes: 18 additions & 19 deletions src/test/kotlin/net/scrayos/xenos/client/data/HeadInfoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@ import net.scrayos.xenos.client.utility.toImage
import scrayosnet.xenos.headResponse
import java.time.Instant

class HeadInfoTest :
ShouldSpec(
{
context("#toResult") {
should("contain original data") {
val response = headResponse {
bytes = ByteString.copyFrom(resourceAsBytes("/image_test.png"))
timestamp = 60
default = true
}
val image = ByteString.copyFrom(resourceAsBytes("/image_test.png")).toImage()
val result = response.toResult()

result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(60)
result.texture shouldBeOfEqualDimensions image
result.texture shouldHaveEqualPixels image
result.default shouldBe true
class HeadInfoTest : ShouldSpec() {
init {
context("#toResult") {
should("contain original data") {
val response = headResponse {
bytes = ByteString.copyFrom(resourceAsBytes("/image_test.png"))
timestamp = 60
default = true
}
val image = ByteString.copyFrom(resourceAsBytes("/image_test.png")).toImage()
val result = response.toResult()

result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(60)
result.texture shouldBeOfEqualDimensions image
result.texture shouldHaveEqualPixels image
result.default shouldBe true
}
},
)
}
}
}
93 changes: 46 additions & 47 deletions src/test/kotlin/net/scrayos/xenos/client/data/ProfileInfoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,54 @@ import scrayosnet.xenos.profileResponse
import java.time.Instant
import java.util.UUID

class ProfileInfoTest :
ShouldSpec(
{
context("#toResult") {
should("contain original data") {
val testUuid = UUID.randomUUID()
val response = profileResponse {
uuid = testUuid.toString()
name = "Scrayos"
properties.addAll(
setOf(
profileProperty {
name = "texture"
value = "abc"
signature = "cde"
},
profileProperty {
name = "meta"
value = "data"
},
),
)
profileActions.addAll(
setOf(
"IMPORTANT_ACTION",
"OTHER_ACTION",
),
)
timestamp = 65
}
val result = response.toResult()

result.id shouldBe testUuid
result.name shouldBe "Scrayos"
result.properties shouldContainExactly setOf(
ProfileInfo.Property(
"texture",
"abc",
"cde",
class ProfileInfoTest : ShouldSpec() {
init {
context("#toResult") {
should("contain original data") {
val testUuid = UUID.randomUUID()
val response = profileResponse {
uuid = testUuid.toString()
name = "Scrayos"
properties.addAll(
setOf(
profileProperty {
name = "texture"
value = "abc"
signature = "cde"
},
profileProperty {
name = "meta"
value = "data"
},
),
ProfileInfo.Property(
"meta",
"data",
null,
)
profileActions.addAll(
setOf(
"IMPORTANT_ACTION",
"OTHER_ACTION",
),
)
result.actions.shouldContainExactly("IMPORTANT_ACTION", "OTHER_ACTION")
result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(65)
timestamp = 65
}
val result = response.toResult()

result.id shouldBe testUuid
result.name shouldBe "Scrayos"
result.properties shouldContainExactly setOf(
ProfileInfo.Property(
"texture",
"abc",
"cde",
),
ProfileInfo.Property(
"meta",
"data",
null,
),
)
result.actions.shouldContainExactly("IMPORTANT_ACTION", "OTHER_ACTION")
result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(65)
}
},
)
}
}
}
37 changes: 18 additions & 19 deletions src/test/kotlin/net/scrayos/xenos/client/data/SkinInfoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@ import net.scrayos.xenos.client.utility.toImage
import scrayosnet.xenos.skinResponse
import java.time.Instant

class SkinInfoTest :
ShouldSpec(
{
context("#toResult") {
should("contain original data") {
val response = skinResponse {
bytes = ByteString.copyFrom(resourceAsBytes("/image_test.png"))
timestamp = 60
default = true
}
val image = ByteString.copyFrom(resourceAsBytes("/image_test.png")).toImage()
val result = response.toResult()

result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(60)
result.texture shouldBeOfEqualDimensions image
result.texture shouldHaveEqualPixels image
result.default shouldBe true
class SkinInfoTest : ShouldSpec() {
init {
context("#toResult") {
should("contain original data") {
val response = skinResponse {
bytes = ByteString.copyFrom(resourceAsBytes("/image_test.png"))
timestamp = 60
default = true
}
val image = ByteString.copyFrom(resourceAsBytes("/image_test.png")).toImage()
val result = response.toResult()

result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(60)
result.texture shouldBeOfEqualDimensions image
result.texture shouldHaveEqualPixels image
result.default shouldBe true
}
},
)
}
}
}
101 changes: 50 additions & 51 deletions src/test/kotlin/net/scrayos/xenos/client/data/UuidInfoTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,60 @@ import scrayosnet.xenos.uuidsResponse
import java.time.Instant
import java.util.UUID

class UuidInfoTest :
ShouldSpec(
{
context("UuidResponse#toResult") {
should("contain original data") {
val testName = "Scrayos"
val testUuid = UUID.randomUUID()
val response = uuidResponse {
uuid = testUuid.toString()
username = testName
timestamp = 65
}
val result = response.toResult()
result.id shouldBe testUuid
result.username shouldBe testName
result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(65)
class UuidInfoTest : ShouldSpec() {
init {
context("UuidResponse#toResult") {
should("contain original data") {
val testName = "Scrayos"
val testUuid = UUID.randomUUID()
val response = uuidResponse {
uuid = testUuid.toString()
username = testName
timestamp = 65
}
val result = response.toResult()
result.id shouldBe testUuid
result.username shouldBe testName
result.retrievedAt shouldBe Instant.EPOCH.plusSeconds(65)
}
}

context("UuidsResponse#toResult") {
should("contain original data") {
val scrayosUuid = UUID.randomUUID()
val hydrofinUuid = UUID.randomUUID()
val response = uuidsResponse {
resolved.putAll(
mapOf(
"scrayos" to uuidResponse {
uuid = scrayosUuid.toString()
username = "Scrayos"
timestamp = 65
},
"hydrofin" to uuidResponse {
uuid = hydrofinUuid.toString()
username = "Hydrofin"
timestamp = 70
},
),
)
}
val result = response.toResult()
context("UuidsResponse#toResult") {
should("contain original data") {
val scrayosUuid = UUID.randomUUID()
val hydrofinUuid = UUID.randomUUID()
val response = uuidsResponse {
resolved.putAll(
mapOf(
"scrayos" to uuidResponse {
uuid = scrayosUuid.toString()
username = "Scrayos"
timestamp = 65
},
"hydrofin" to uuidResponse {
uuid = hydrofinUuid.toString()
username = "Hydrofin"
timestamp = 70
},
),
)
}
val result = response.toResult()

result.shouldContainKeys("scrayos", "hydrofin")
result.shouldContainKeys("scrayos", "hydrofin")

val scrayos = result["scrayos"]
scrayos.shouldNotBeNull()
scrayos.id shouldBe scrayosUuid
scrayos.username shouldBe "Scrayos"
scrayos.retrievedAt shouldBe Instant.EPOCH.plusSeconds(65)
val scrayos = result["scrayos"]
scrayos.shouldNotBeNull()
scrayos.id shouldBe scrayosUuid
scrayos.username shouldBe "Scrayos"
scrayos.retrievedAt shouldBe Instant.EPOCH.plusSeconds(65)

val hydrofin = result["hydrofin"]
hydrofin.shouldNotBeNull()
hydrofin.id shouldBe hydrofinUuid
hydrofin.username shouldBe "Hydrofin"
hydrofin.retrievedAt shouldBe Instant.EPOCH.plusSeconds(70)
}
val hydrofin = result["hydrofin"]
hydrofin.shouldNotBeNull()
hydrofin.id shouldBe hydrofinUuid
hydrofin.username shouldBe "Hydrofin"
hydrofin.retrievedAt shouldBe Instant.EPOCH.plusSeconds(70)
}
},
)
}
}
}
Loading

0 comments on commit a5fd6fe

Please sign in to comment.