generated from vextorspace/KotlinMultiplatformTesting
-
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.
reading an empty file works for desktop
- Loading branch information
1 parent
26cf217
commit d5ea239
Showing
5 changed files
with
63 additions
and
0 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
44 changes: 44 additions & 0 deletions
44
composeApp/src/desktopTest/kotlin/resources/ReadAppFileTest.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,44 @@ | ||
package resources | ||
|
||
import io.kotest.matchers.nulls.shouldBeNull | ||
import io.kotest.matchers.nulls.shouldNotBeNull | ||
import io.kotest.matchers.string.shouldBeEmpty | ||
import kotlin.test.AfterTest | ||
import kotlin.test.BeforeTest | ||
import kotlin.test.Test | ||
|
||
class ReadAppFileTest { | ||
|
||
val appFile = AppFile("appFile.json") | ||
|
||
@BeforeTest | ||
fun setup() { | ||
if(appFile.exists()) { | ||
appFile.delete() | ||
} | ||
} | ||
|
||
@AfterTest | ||
fun teardown() { | ||
if(appFile.exists()) { | ||
appFile.delete() | ||
} | ||
} | ||
|
||
@Test | ||
fun `Non-existent App File Reads null`() { | ||
val appFile = AppFile("appFile.json") | ||
appFile.readText() | ||
.shouldBeNull() | ||
} | ||
|
||
@Test | ||
fun `Reads Empty App File`() { | ||
val appFile = AppFile("appFile.json") | ||
appFile.create() | ||
|
||
appFile.readText() | ||
.shouldNotBeNull() | ||
.shouldBeEmpty() | ||
} | ||
} |
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