Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ kotlin {
implementation(libs.io.ktor.client.mock)
implementation(libs.org.jetbrains.kotlin.test.common)
implementation(libs.org.jetbrains.kotlin.test.annotations.common)
implementation(libs.org.jetbrains.kotlinx.coroutines.test)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ import kotlin.test.assertTrue
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.Json
import kotlin.test.Test
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest

@OptIn(ExperimentalCoroutinesApi::class)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest adding this to kotlin compiler args in certain modules so we don't have to specify it all over the place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, but it looks like it is not available in KMP. I'll investigate later and do a PR if it is possible.

class MastodonApiTests {
// TODO: fix loading json from resources
// @Test
fun `Instance request should fail with invalid response`() = runBlocking {
@Test
@Ignore
fun `Instance request should fail with invalid response`() = runTest {
// given
// val content: String = javaClass.classLoader.getResource("response_instance_invalid.json").readText()
val content: String = ""
Expand All @@ -41,8 +45,9 @@ class MastodonApiTests {
}

// TODO: fix loading json from resources
//@Test
fun `Instance request should succeed with required field response`() = runBlocking {
@Test
@Ignore
fun `Instance request should succeed with required field response`() = runTest {
// given
// val content: String = javaClass.classLoader.getResource("response_instance_valid.json").readText()
val content: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AccountTests {
// TODO: fix loading json from resources
@Ignore
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
//val json: String = javaClass.classLoader.getResource("response_account_required.json").readText()
val json: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.test.Test

class ActivityTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlin.test.Test

class AnnouncementReactionTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import kotlin.test.assertNotNull

class AnnouncementTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlin.test.assertNull

class ApplicationTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlinx.serialization.json.Json

class AttachmentTests {
@Test
fun `deserialize image example should succeed`() = runBlocking {
fun `deserialize image example should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.test.Test

class CardTests {
@Test
fun `deserialize video card should succeed`() = runBlocking {
fun `deserialize video card should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ContextTests {
// TODO: fix loading json from resources
@Ignore
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
// val json: String = javaClass.classLoader.getResource("response_context_required.json").readText()
val json: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ConversationTests {
// TODO: fix loading json from resources
@Ignore
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
// val json: String = javaClass.classLoader.getResource("response_conversation_required.json").readText()
val json: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.test.Test

class EmojiTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.test.Test

class ErrorTests {
@Test
fun `deserialize video card should succeed`() = runBlocking {
fun `deserialize video card should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.test.Test

class FeatureTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.serialization.json.Json

class FilterTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.test.Test

class HistoryTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.serialization.json.Json

class IdentityProofTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.test.Test

class MarkerTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlinx.serialization.json.Json

class MentionTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class NotificationTests {
// TODO: fix loading json from resources
@Ignore
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
// val json: String = javaClass.classLoader.getResource("response_notification_required.json").readText()
val json: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlinx.serialization.json.Json

class PollTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlinx.serialization.json.Json

class PreferencesTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.test.Test

class PushSubscriptionTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class StatusTests {
// TODO: fix loading json from resources
@Ignore
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
// val json: String = javaClass.classLoader.getResource("response_status_required.json").readText()
val json: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.serialization.json.Json

class TagTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.test.Test

class UserListTests {
@Test
fun `deserialize required fields should succeed`() = runBlocking {
fun `deserialize required fields should succeed`() {
// given
val json = """
{
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# plugins
org-jetbrains-compose = "1.2.1"
org-jetbrains-kotlin = "1.7.20"
org-jetbrains-kotlinx-coroutines = "1.6.4"
com-android-tools-build = "7.2.2"
com-squareup-sqldelight = "1.5.3"
# libraries
Expand Down Expand Up @@ -33,6 +34,7 @@ io-ktor-client-mock-jvm = { module = "io.ktor:ktor-client-mock-jvm", version.ref
io-ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "io-ktor" }
io-ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "io-ktor" }

org-jetbrains-kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "org-jetbrains-kotlinx-coroutines"}
org-jetbrains-kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "org-jetbrains-kotlinx" }

org-jetbrains-kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "org-jetbrains-kotlin" }
Expand Down