Skip to content

Commit 1f69fb9

Browse files
committed
refactor: test adjustment
1 parent 895f0aa commit 1f69fb9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

ychat/src/commonTest/kotlin/co/yml/ychat/entrypoint/YChatTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class YChatTest {
7676
@Test
7777
fun `on imageGenerations execute method should return result successfully`() {
7878
// arrange
79-
val textResult = "This in indeed a test"
80-
val imageGenerationsSuccessResult = MockStorage.imageGenerationsSuccessResult(textResult)
79+
val imageUrl = "https://testlink.com/image-test.jpg"
80+
val imageGenerationsSuccessResult = MockStorage.imageGenerationsSuccessResult(imageUrl)
8181
mockHttpEngine(imageGenerationsSuccessResult)
8282

8383
// act
@@ -90,7 +90,7 @@ class YChatTest {
9090
}
9191

9292
// assert
93-
assertEquals("https://testlink.com/image-test.jps", result.first())
93+
assertEquals("https://testlink.com/image-test.jpg", result.first())
9494
}
9595

9696
private fun mockHttpEngine(result: String) {

ychat/src/commonTest/kotlin/infrastructure/MockStorage.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ object MockStorage {
1414
"\"choices\":[{\"message\":{\"role\":\"assistant\",\"content\":\"$text\"}," +
1515
"\"finish_reason\":\"stop\",\"index\":0}]}"
1616

17-
fun imageGenerationsSuccessResult(text: String) = "{\"created\":1678805561,\"data\":[{\"url\":\"https://testlink.com/image-test.jps\"}]}"
17+
fun imageGenerationsSuccessResult(text: String) =
18+
"{\"created\":1678805561,\"data\":[{\"url\":\"$text\"}]}"
1819
}

0 commit comments

Comments
 (0)