From 3f0a3903ae0b2ab34dab0a08595e02e7d8d162a5 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Mon, 26 Sep 2022 22:50:55 +0200 Subject: [PATCH] Test refresh login information --- .../readerforselfossv2/repository/RepositoryTest.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt b/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt index ea76e26..dc762a2 100644 --- a/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt +++ b/shared/src/commonTest/kotlin/bou/amine/apps/readerforselfossv2/repository/RepositoryTest.kt @@ -680,6 +680,18 @@ class RepositoryTest() { coVerify(exactly = 0) { api.login() } assertSame(false, response) } + + @Test + fun `refresh login information`() { + coEvery { api.refreshLoginInformation() } returns Unit + coEvery { appSettingsService.refreshLoginInformation(any(), any(), any()) } returns Unit + + val repository = Repository(api, appSettingsService, connectivityStatus, db) + repository.refreshLoginInformation("https://test.com/selfoss/", "login", "password") + + coVerify(exactly = 1) { api.refreshLoginInformation() } + coVerify(exactly = 1) {appSettingsService.refreshLoginInformation("https://test.com/selfoss/", "login", "password")} + } } fun generateTestDBItems(item : FakeItemParameters = FakeItemParameters()) : List {