Skip to content

Commit 9e250fd

Browse files
committed
Make tests more accurate
1 parent 2e8ad65 commit 9e250fd

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

src/commonTest/kotlin/net/pearx/kpastebin/test/LoggedInTest.kt

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,32 @@ class LoggedInTest {
3232

3333
@Test
3434
fun listingPastes() = runTest {
35-
assertEquals(listOf(
36-
PasteDetails(
37-
"0b42rwhf",
38-
1297953260UL,
39-
"javascript test",
40-
15,
41-
1297956860UL,
42-
Privacy.PUBLIC,
43-
"JavaScript",
44-
"javascript",
45-
"https://pastebin.com/0b42rwhf",
46-
15
47-
),
48-
PasteDetails(
49-
"0C343n0d",
50-
1297694343UL,
51-
"Welcome To Pastebin V3",
52-
490,
53-
0UL,
54-
Privacy.PUBLIC,
55-
"None",
56-
"text",
57-
"https://pastebin.com/0C343n0d",
58-
65
59-
)
60-
), createClient(userKey = globalUserKey).listPastes())
35+
val pastes = createClient(userKey = globalUserKey).listPastes()
36+
assertEquals(2, pastes.size)
37+
pastes[0].apply {
38+
assertEquals("0b42rwhf", key)
39+
assertEquals(1297953260UL, date)
40+
assertEquals("javascript test", title)
41+
assertEquals(15, size)
42+
assertEquals(1297956860UL, expireDate)
43+
assertEquals(Privacy.PUBLIC, privacy)
44+
assertEquals("JavaScript", formatLong)
45+
assertEquals("javascript", formatShort)
46+
assertEquals("https://pastebin.com/0b42rwhf", url)
47+
assertEquals(15, hits)
48+
}
49+
pastes[1].apply {
50+
assertEquals("0C343n0d", key)
51+
assertEquals(1297694343UL, date)
52+
assertEquals("Welcome To Pastebin V3", title)
53+
assertEquals(490, size)
54+
assertEquals(0UL, expireDate)
55+
assertEquals(Privacy.PUBLIC, privacy)
56+
assertEquals("None", formatLong)
57+
assertEquals("text", formatShort)
58+
assertEquals("https://pastebin.com/0C343n0d", url)
59+
assertEquals(65, hits)
60+
}
6161
}
6262

6363
@Test
@@ -82,17 +82,17 @@ class LoggedInTest {
8282

8383
@Test
8484
fun gettingUserDetails() = runTest {
85-
assertEquals(UserDetails(
86-
"wiz_kitty",
87-
"text",
88-
ExpireDate.NEVER,
89-
"https://pastebin.com/cache/a/1.jpg",
90-
Privacy.UNLISTED,
91-
"https://myawesomesite.com",
92-
"oh@dear.com",
93-
"New York",
94-
AccountType.PRO
95-
), createClient(userKey = globalUserKey).getUserDetails())
85+
createClient(userKey = globalUserKey).getUserDetails().apply {
86+
assertEquals("wiz_kitty", name)
87+
assertEquals("text", defaultFormatShort)
88+
assertEquals(ExpireDate.NEVER, defaultExpiration)
89+
assertEquals("https://pastebin.com/cache/a/1.jpg", avatarUrl)
90+
assertEquals(Privacy.UNLISTED, defaultPrivacy)
91+
assertEquals("https://myawesomesite.com", website)
92+
assertEquals("oh@dear.com", email)
93+
assertEquals("New York", location)
94+
assertEquals(AccountType.PRO, accountType)
95+
}
9696
}
9797

9898
@Test

0 commit comments

Comments
 (0)