|
1 | 1 | import * as fs from 'fs'; |
2 | 2 |
|
3 | 3 | import { FileManager } from '../../../../../../core/project/persistence/manager/file.manager'; |
4 | | -import { Project } from '../../../../../../core/project/project.entity'; |
5 | | -// import { assertCreatedFileWithEmptyContent } from './common-asserts'; |
| 4 | +import { assertCreatedFileWithEmptyContent } from './common-asserts'; |
6 | 5 |
|
7 | 6 | const fixturesPath = `${__dirname}/../../../../../fixtures`; |
8 | 7 |
|
9 | 8 | describe('File manager', () => { |
10 | 9 | describe('Delete', () => { |
11 | | - // describe('When folder not exists', () => { |
12 | | - // const path = `${fixturesPath}/not-existent-folder`; |
13 | | - // const projectsFile = `${path}/projects.json`; |
14 | | - // const alias = 'funny'; |
| 10 | + describe('When folder not exists', () => { |
| 11 | + const path = `${fixturesPath}/not-existent-folder`; |
| 12 | + const projectsFile = `${path}/projects.json`; |
| 13 | + const alias = 'funny'; |
15 | 14 |
|
16 | | - // let result: boolean; |
| 15 | + let result: boolean; |
17 | 16 |
|
18 | | - // beforeAll(() => { |
19 | | - // const fileManager = new FileManager(path); |
| 17 | + beforeAll(() => { |
| 18 | + const fileManager = new FileManager(path); |
20 | 19 |
|
21 | | - // result = fileManager.delete(alias); |
22 | | - // }); |
| 20 | + result = fileManager.delete(alias); |
| 21 | + }); |
23 | 22 |
|
24 | | - // afterAll(() => { |
25 | | - // fs.unlinkSync(projectsFile); |
26 | | - // fs.rmdirSync(path); |
27 | | - // }); |
| 23 | + afterAll(() => { |
| 24 | + fs.unlinkSync(projectsFile); |
| 25 | + fs.rmdirSync(path); |
| 26 | + }); |
28 | 27 |
|
29 | | - // it('should return undefined', () => { |
30 | | - // expect(result).toBe(false); |
31 | | - // }); |
| 28 | + it('should return undefined', () => { |
| 29 | + expect(result).toBe(false); |
| 30 | + }); |
32 | 31 |
|
33 | | - // assertCreatedFileWithEmptyContent(projectsFile); |
34 | | - // }); |
| 32 | + assertCreatedFileWithEmptyContent(projectsFile); |
| 33 | + }); |
35 | 34 |
|
36 | | - // describe('When folder already exists', () => { |
37 | | - // const path = `${fixturesPath}/projects-folder`; |
38 | | - // const projectsFile = `${path}/projects.json`; |
| 35 | + describe('When folder already exists', () => { |
| 36 | + const path = `${fixturesPath}/projects-folder`; |
| 37 | + const projectsFile = `${path}/projects.json`; |
39 | 38 |
|
40 | | - // let result: boolean; |
| 39 | + let result: boolean; |
41 | 40 |
|
42 | | - // beforeAll(() => { |
43 | | - // const fileManager = new FileManager(path); |
| 41 | + beforeAll(() => { |
| 42 | + const fileManager = new FileManager(path); |
44 | 43 |
|
45 | | - // result = fileManager.delete('project'); |
46 | | - // }); |
| 44 | + result = fileManager.delete('project'); |
| 45 | + }); |
47 | 46 |
|
48 | | - // afterAll(() => { |
49 | | - // fs.unlinkSync(projectsFile); |
50 | | - // }); |
| 47 | + afterAll(() => { |
| 48 | + fs.unlinkSync(projectsFile); |
| 49 | + }); |
51 | 50 |
|
52 | | - // it('should return undefined', () => { |
53 | | - // expect(result).toBe(false); |
54 | | - // }); |
| 51 | + it('should return undefined', () => { |
| 52 | + expect(result).toBe(false); |
| 53 | + }); |
55 | 54 |
|
56 | | - // assertCreatedFileWithEmptyContent(projectsFile); |
57 | | - // }); |
| 55 | + assertCreatedFileWithEmptyContent(projectsFile); |
| 56 | + }); |
58 | 57 |
|
59 | | - // describe('When projects file already exists', () => { |
60 | | - // const path = `${fixturesPath}/projects-file`; |
61 | | - // const projectsFile = `${path}/projects.json`; |
| 58 | + describe('When projects file already exists', () => { |
| 59 | + const path = `${fixturesPath}/projects-file`; |
| 60 | + const projectsFile = `${path}/projects.json`; |
62 | 61 |
|
63 | | - // let result: boolean; |
| 62 | + let result: boolean; |
64 | 63 |
|
65 | | - // beforeAll(() => { |
66 | | - // const fileManager = new FileManager(path); |
| 64 | + beforeAll(() => { |
| 65 | + const fileManager = new FileManager(path); |
67 | 66 |
|
68 | | - // result = fileManager.delete('project'); |
69 | | - // }); |
| 67 | + result = fileManager.delete('project'); |
| 68 | + }); |
70 | 69 |
|
71 | | - // afterAll(() => { |
72 | | - // // Reset file |
73 | | - // fs.writeFileSync(projectsFile, JSON.stringify({ projects: [] })); |
74 | | - // }); |
| 70 | + afterAll(() => { |
| 71 | + // Reset file |
| 72 | + fs.writeFileSync(projectsFile, JSON.stringify({ projects: [] })); |
| 73 | + }); |
75 | 74 |
|
76 | | - // it('should return undefined', () => { |
77 | | - // expect(result).toBe(false); |
78 | | - // }); |
| 75 | + it('should return undefined', () => { |
| 76 | + expect(result).toBe(false); |
| 77 | + }); |
79 | 78 |
|
80 | | - // assertCreatedFileWithEmptyContent(projectsFile); |
81 | | - // }); |
| 79 | + assertCreatedFileWithEmptyContent(projectsFile); |
| 80 | + }); |
82 | 81 |
|
83 | 82 | describe('When already have projects created', () => { |
84 | 83 | const path = `${fixturesPath}/unordered-projects-list`; |
|
0 commit comments