Skip to content

Commit

Permalink
use okio in apollo-testing-support
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Mar 13, 2024
1 parent c6e1a84 commit 052fa50
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 32 deletions.
6 changes: 0 additions & 6 deletions libraries/apollo-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ kotlin {
api(project(":apollo-annotations"))
}
}

findByName("jsMain")?.apply {
dependencies {
implementation(libs.okio.nodefilesystem)
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ package com.apollographql.apollo3.api

import okio.FileSystem
import okio.Path
import okio.SYSTEM
import okio.buffer
import okio.use
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName

fun Path.toUpload(contentType: String, fileSystem: FileSystem = systemFileSystem): Upload {
fun Path.toUpload(contentType: String, fileSystem: FileSystem = FileSystem.SYSTEM): Upload {
return DefaultUpload.Builder()
.content { sink ->
fileSystem.openReadOnly(this).use {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.apollographql.apollo3.api

import okio.FileSystem
import okio.NodeJsFileSystem

internal actual val systemFileSystem: FileSystem
get() = NodeJsFileSystem
get() = throw IllegalStateException("There is no SYSTEM filesystem on JS")
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ public final class com/apollographql/apollo3/testing/MockserverKt {
public static synthetic fun enqueueData$default (Lcom/apollographql/apollo3/mockserver/MockServer;Ljava/util/Map;Lcom/apollographql/apollo3/api/CustomScalarAdapters;JIILjava/lang/Object;)V
}

public final class com/apollographql/apollo3/testing/ReadFileJvmKt {
public static final fun getHostFileSystem ()Lokio/FileSystem;
public final class com/apollographql/apollo3/testing/ReadFile_concurrentKt {
}

public final class com/apollographql/apollo3/testing/ReadFile_jvmKt {
public static final fun getTestsPath ()Ljava/lang/String;
public static final fun shouldUpdateTestFixtures ()Z
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.apollographql.apollo3.testing

actual fun shouldUpdateTestFixtures(): Boolean = false

actual val testsPath: String = "../"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.apollographql.apollo3.testing

import com.apollographql.apollo3.annotations.ApolloExperimental
import okio.FileSystem
import okio.SYSTEM

/**
* The host filesystem
*/
@ApolloExperimental
actual val HostFileSystem: FileSystem
get() = FileSystem.SYSTEM
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
package com.apollographql.apollo3.testing

import okio.FileSystem
import okio.IOException
import okio.Path.Companion.toPath
import okio.buffer
import java.io.File
import java.io.FileNotFoundException

actual val HostFileSystem = FileSystem.SYSTEM

actual fun shouldUpdateTestFixtures(): Boolean {
if (System.getenv("updateTestFixtures") != null) {
return true
Expand Down

0 comments on commit 052fa50

Please sign in to comment.