From bdc34c1de5e2482d257eb9e9ce958bf0d7c0e620 Mon Sep 17 00:00:00 2001 From: Alex Gabor Date: Fri, 28 Jan 2022 10:40:49 +0200 Subject: [PATCH] Proof read core integration instruction set --- codekata/core.again.instructionset.md | 9 +++++---- .../core/integration/CodeKataAuthIntegrationTest.kt | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/codekata/core.again.instructionset.md b/codekata/core.again.instructionset.md index 7a9adc1..0275353 100644 --- a/codekata/core.again.instructionset.md +++ b/codekata/core.again.instructionset.md @@ -130,7 +130,7 @@ We are still missing `mockServerScenarioSetupExtensions` this will be our TestEx `MockServerScenarioSetupExtensions` is declared in the `:network` test module. However we are still able to import it. -That's because of [java-test-fixtures](https://docs.gradle.org/current/userguide/java_testing.html#sec:java_test_fixtures) plugin. It is can be used to depend on a specific test module "textFixtures". +That's because of [java-test-fixtures](https://docs.gradle.org/current/userguide/java_testing.html#sec:java_test_fixtures) plugin. It can be used to depend on a specific test module "textFixtures". Check out the build.gradle's to see how that's done. This can be useful to share some static Test Data, or extensions in our case. @@ -153,13 +153,14 @@ As usual, we start with the simplest test. Let's verify that if the session obje ```kotlin @DisplayName("GIVEN no session saved WHEN checking if user is logged in THEN they are not") - @Test - fun withoutSessionTheUserIsNotLoggedIn() = runTest { +@Test +fun withoutSessionTheUserIsNotLoggedIn() = runTest { fakeUserDataLocalStorage.session = null val actual = isUserLoggedInUseCase.invoke() Assertions.assertFalse(actual, "User is expected to be not logged in") verifyZeroInteractions(mockSessionExpirationListener) +} ``` ### 2. `loginSuccess` @@ -251,7 +252,7 @@ fun networkInputError(authScenario: AuthScenario) = runTest { We have one more expected error type, but this comes from the NetworkResponse. We could add it as parametrized test, but for the sake of readability, let's just keep it separate. -Thi is really similar to the `networkInputError`, the differences are that this is not parametrized, we use `AuthScenario.InvalidCredentials` response and we expect `Answer.Success(LoginStatus.INVALID_CREDENTIALS)` +This is really similar to the `networkInputError`, the differences are that this is not parametrized, we use `AuthScenario.InvalidCredentials` response and we expect `Answer.Success(LoginStatus.INVALID_CREDENTIALS)` So together: ```kotlin diff --git a/core/src/test/java/org/fnives/test/showcase/core/integration/CodeKataAuthIntegrationTest.kt b/core/src/test/java/org/fnives/test/showcase/core/integration/CodeKataAuthIntegrationTest.kt index 3907e7f..adc63fd 100644 --- a/core/src/test/java/org/fnives/test/showcase/core/integration/CodeKataAuthIntegrationTest.kt +++ b/core/src/test/java/org/fnives/test/showcase/core/integration/CodeKataAuthIntegrationTest.kt @@ -44,7 +44,7 @@ class CodeKataAuthIntegrationTest : KoinTest { @BeforeEach fun setup() { - mockSessionExpirationListener = mock() // we are using mock, since it only has 1 function so we just want to verify if it's called + mockSessionExpirationListener = mock() // we are using mock, since it only has 1 function so we just want to verify if its called fakeFavouriteContentLocalStorage = FakeFavouriteContentLocalStorage() fakeUserDataLocalStorage = FakeUserDataLocalStorage(null) startKoin {