Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
esotericenderman committed Oct 30, 2024
1 parent 488f975 commit 31b57ab
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,22 @@ import kotlin.test.*
class FileManagerTest {

private lateinit var plugin: TestPlugin
private lateinit var fileManager: FileManager

@BeforeTest fun mockFileManager() {
MockBukkit.mock()
plugin = MockBukkit.load(TestPlugin::class.java)
fileManager = FileManager(plugin)
}

@Test fun savingFolderWorks() {
fileManager.saveResourceFolder("file/FileManagerTest/1")
plugin.fileManager.saveResourceFolder("file/FileManagerTest")

val fileDir = File(plugin.dataFolder, "file")
val fileManagerTestDir = File(fileDir, "FileManagerTest")
val testOneDir = File(fileManagerTestDir, "1")

val testFileOne = File(testOneDir, "Test File 1.txt")
val testFileTwo = File(testOneDir, "Test File 2.txt")
val testFileOne = File(fileManagerTestDir, "Test File 1.txt")
val testFileTwo = File(fileManagerTestDir, "Test File 2.txt")

val subFolder = File(testOneDir, "Subfolder")
val subFolder = File(fileManagerTestDir, "Subfolder")

val testFileThree = File(subFolder, "Test File 3.txt")

Expand All @@ -38,12 +35,7 @@ class FileManagerTest {
assertTrue(fileManagerTestDir.exists())
assertTrue(fileManagerTestDir.isDirectory)
assertNotNull(fileManagerTestDir.listFiles())
assertEquals(fileManagerTestDir.listFiles()!!.size, 1)

assertTrue(testOneDir.exists())
assertTrue(testOneDir.isDirectory)
assertNotNull(testOneDir.listFiles())
assertEquals(testOneDir.listFiles()!!.size, 3)
assertEquals(fileManagerTestDir.listFiles()!!.size, 3)

assertTrue(testFileOne.exists())
assertFalse(testFileOne.isDirectory)
Expand Down

0 comments on commit 31b57ab

Please sign in to comment.