Added update config builder. Closes #8

This commit is contained in:
Erik C. Thauvin 2022-10-22 00:04:15 -07:00
parent 82d31578c8
commit 31f5aac584
7 changed files with 225 additions and 4 deletions

View file

@ -200,6 +200,34 @@ class BitlyTest {
assertThat(bl.lastCallResponse).prop(CallResponse::isUnprocessableEntity).isTrue()
}
@Test
fun `update bitlink with config`() {
val bl = bitly.bitlinks()
var config = UpdateConfig.Builder().apply {
bitlink(shortUrl)
title("Erik's Weblog")
tags(arrayOf("blog", "weblog"))
archived(true)
}.build()
assertEquals(Constants.TRUE, bl.update(config))
config = UpdateConfig.Builder().apply {
bitlink(shortUrl)
toJson(true)
}.build()
assertThat(bl.update(config), "update(tags)").contains("\"tags\":[]")
config = UpdateConfig.Builder().apply {
bitlink(shortUrl)
link(longUrl)
}.build()
bl.update(config)
assertThat(bl.lastCallResponse).prop(CallResponse::isUnprocessableEntity).isTrue()
}
@Test
fun `validate URL`() {
assertTrue("https://www.example.com".isValidUrl(), "valid url")