mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
feat: add post-build-script to gradually migrate
This commit is contained in:
1 parent
3977db87a3
commit
8eaec839d3
11 files changed
+624
-154
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import File from './file.js'
|
||||
|
||||
describe('File', () => {
|
||||
let file
|
||||
beforeEach(() => {
|
||||
file = new File({ path: '/home/user', type: 'folder', discovered: true })
|
||||
})
|
||||
|
||||
const filesToCompare = [
|
||||
{
|
||||
name: 'direct children',
|
||||
path: '/home/user/file1.txt',
|
||||
answer: true,
|
||||
},
|
||||
{
|
||||
name: 'nested children',
|
||||
path: '/home/user/folder1/file1.txt',
|
||||
answer: true,
|
||||
},
|
||||
{
|
||||
name: 'outer file',
|
||||
path: '/etc/file1.txt',
|
||||
answer: false,
|
||||
},
|
||||
{
|
||||
name: 'fake children',
|
||||
path: '/home/user2/file2.txt',
|
||||
answer: false,
|
||||
},
|
||||
{
|
||||
name: 'same',
|
||||
path: '/home/user',
|
||||
answer: true,
|
||||
},
|
||||
{
|
||||
name: 'same with trailing',
|
||||
path: '/home/user/',
|
||||
answer: true,
|
||||
},
|
||||
]
|
||||
|
||||
filesToCompare.forEach(({ name, path, answer }) => {
|
||||
test(`${name}: ${path}`, () => {
|
||||
const fileToCompare = new File({ path, type: 'file', discovered: true })
|
||||
expect(file.contains(fileToCompare)).toBe(answer)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user