mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2025-05-18 12:02:53 +02:00
test(cli): add commands/run/test
This commit is contained in:
@ -17,7 +17,7 @@ describe('utils/copyDirectory', () => {
|
||||
'.npmignore': ''
|
||||
},
|
||||
'/destination': {}
|
||||
})
|
||||
}, { createCwd: false })
|
||||
|
||||
let destinationDirectoryContent = await fs.promises.readdir('/destination')
|
||||
let sourceDirectoryContent = await fs.promises.readdir('/source')
|
||||
@ -50,7 +50,7 @@ describe('utils/copyDirectory', () => {
|
||||
'.npmignore': ''
|
||||
},
|
||||
'/destination': {}
|
||||
})
|
||||
}, { createCwd: false })
|
||||
|
||||
let destinationDirectoryContent = await fs.promises.readdir('/destination')
|
||||
let sourceDirectoryContent = await fs.promises.readdir('/source')
|
||||
|
@ -13,19 +13,12 @@ describe('utils/createTemporaryEmptyFolder', () => {
|
||||
fsMock.restore()
|
||||
})
|
||||
|
||||
it('should create the temporary folder', async () => {
|
||||
fsMock({})
|
||||
expect(await isExistingPath(TEMPORARY_PATH)).toBeFalsy()
|
||||
await createTemporaryEmptyFolder()
|
||||
expect(await isExistingPath(TEMPORARY_PATH)).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should remove and create again the temporary folder', async () => {
|
||||
fsMock({
|
||||
[TEMPORARY_PATH]: {
|
||||
'file.txt': ''
|
||||
}
|
||||
})
|
||||
}, { createCwd: false })
|
||||
expect(await isExistingPath(TEMPORARY_PATH)).toBeTruthy()
|
||||
expect((await fs.promises.readdir(TEMPORARY_PATH)).length).toEqual(1)
|
||||
await createTemporaryEmptyFolder()
|
||||
|
@ -10,14 +10,14 @@ describe('utils/isExistingFile', () => {
|
||||
it('should return true if the file exists', async () => {
|
||||
fsMock({
|
||||
'/file.txt': ''
|
||||
})
|
||||
}, { createCwd: false })
|
||||
expect(await isExistingPath('/file.txt')).toBeTruthy()
|
||||
})
|
||||
|
||||
it("should return false if the file doesn't exists", async () => {
|
||||
fsMock({
|
||||
'/file.txt': ''
|
||||
})
|
||||
}, { createCwd: false })
|
||||
expect(await isExistingPath('/randomfile.txt')).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user