generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#13] Add JsonApi, move dependencies to plugins and minor reviews res…
…olves
- Loading branch information
1 parent
4c14109
commit 84fbc5c
Showing
17 changed files
with
84 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Staging env | ||
STAGING_BASE_URL= | ||
# Production env | ||
PRODUCTION_BASE_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ommonMain/kotlin/co/nimblehq/kmm/template/data/remote/datasources/UserRemoteDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ata/remote/model/response/UserResponse.kt → ...ta/remote/model/responses/UserResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...emplate/data/repository/RepositoryImpl.kt → ...plate/data/repositories/RepositoryImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
shared/src/commonMain/kotlin/co/nimblehq/kmm/template/domain/exceptions/ApiException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package co.nimblehq.kmm.template.domain.exceptions | ||
|
||
data class ApiException( | ||
val code: String?, | ||
override val message: String?, | ||
override val cause: Throwable? = null | ||
) : RuntimeException(message, cause) |
2 changes: 1 addition & 1 deletion
2
...emplate/data/repository/RepositoryTest.kt → ...plate/data/repositories/RepositoryTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
shared/src/commonTest/kotlin/co/nimblehq/kmm/template/extensions/ResponseMappingTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package co.nimblehq.kmm.template.extensions | ||
|
||
import app.cash.turbine.test | ||
import co.nimblehq.kmm.template.data.extensions.flowTransform | ||
import co.nimblehq.kmm.template.domain.model.UserModel | ||
import io.kotest.matchers.shouldBe | ||
import io.ktor.utils.io.errors.* | ||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.test.runTest | ||
import kotlin.test.Test | ||
|
||
@ExperimentalCoroutinesApi | ||
class ResponseMappingTest { | ||
|
||
@Test | ||
fun `When mapping API request flow failed with Exception - it returns Exception error`() = runTest { | ||
flowTransform<UserModel> { | ||
throw Exception() | ||
}.test { | ||
awaitError() shouldBe Exception() | ||
} | ||
} | ||
|
||
@Test | ||
fun `When mapping API request flow failed with a generic error - it returns that error`() = runTest { | ||
val error = IOException("no internet") | ||
flowTransform<UserModel> { | ||
throw error | ||
}.test { | ||
awaitError() shouldBe error | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
shared/src/commonTest/kotlin/co/nimblehq/kmm/template/util/Fake.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters