-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3facd70
commit b0402b4
Showing
1 changed file
with
0 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,29 @@ | ||
import { FileInspector } from '.'; | ||
import { createTestContainer, TestContainerContext } from '../inversify.config'; | ||
import { FileSystemService } from '../services'; | ||
import { DirectoryJSON } from 'memfs/lib/volume'; | ||
import path from 'path'; | ||
|
||
describe('GitignoreIsPresentPractice', () => { | ||
let fileInspector: FileInspector; | ||
let containerCtx: TestContainerContext; | ||
let virtualFileSystemService: FileSystemService; | ||
|
||
beforeAll(() => { | ||
containerCtx = createTestContainer(); | ||
containerCtx.container.bind('FileInspector').to(FileInspector); | ||
fileInspector = containerCtx.container.get('FileInspector'); | ||
}); | ||
|
||
// beforeEach(() => { | ||
// virtualFileSystemService = new FileSystemService({ isVirtual: true }); | ||
// fileInspector = new FileInspector(virtualFileSystemService, '/'); | ||
// }); | ||
|
||
afterEach(async () => { | ||
containerCtx.virtualFileSystemService.clearFileSystem(); | ||
containerCtx.practiceContext.fileInspector!.purgeCache(); | ||
}); | ||
|
||
it('Throws an error if the file does not exist', async () => { | ||
const path = './'; | ||
// const structure: DirectoryJSON = { | ||
// '/index.cpp': '...', | ||
// }; | ||
|
||
// virtualFileSystemService.setFileSystem(structure); | ||
try { | ||
await fileInspector.scanFor('not.exist', path); | ||
fail(); | ||
} catch (error) { | ||
expect(error.message).toEqual(`ENOENT: no such file or directory, readdir '${path}'`); | ||
} | ||
// expect(async () => { | ||
// await fileInspector.scanFor('not.exist', path); | ||
// }).toThrow(); | ||
}); | ||
|
||
// it('Returns practicing if there is a .gitignore', async () => { | ||
// const structure: DirectoryJSON = { | ||
// '/index.cpp': '...', | ||
// }; | ||
|
||
// virtualFileSystemService.setFileSystem(structure); | ||
// const isFile = await fileInspector.isFile('/index.cpp'); | ||
// expect(isFile).toEqual(true); | ||
// }); | ||
}); |