Implemented lastCallResponse property. Closes #2

This commit is contained in:
Erik C. Thauvin 2020-07-31 13:26:09 -07:00
parent 683cb3aa35
commit b12931c6ad
10 changed files with 53 additions and 19 deletions

View file

@ -123,6 +123,15 @@ class BitlyTest {
assertEquals(longUrl, Bitlinks(bitly.accessToken).expand(shortUrl))
}
@Test
fun `bitlinks lastCallResponse`() {
val bl = Bitlinks(bitly.accessToken)
bl.shorten(longUrl, domain="bit.ly")
assertEquals(true, bl.lastCallResponse.isSuccessful, "is successful")
assertEquals(200, bl.lastCallResponse.resultCode, "resultCode == 200")
assertTrue(bl.lastCallResponse.body.contains("\"link\":\"$shortUrl\""), "valid body")
}
@Test
fun `clicks summary`() {
assertNotEquals(Constants.EMPTY, bitly.bitlinks().clicks(shortUrl))