|
1 | | -import { describe, test, expect, vi } from 'vitest' |
| 1 | +import { describe, test, expect } from 'vitest' |
2 | 2 | import { ModelDirectory } from './directory' |
3 | 3 |
|
4 | | -vi.mock('../utils/index', async () => { |
5 | | - const actual: any = await vi.importActual('../utils/index') |
6 | | - |
7 | | - return { |
8 | | - ...actual, |
9 | | - PATH_SEPARATOR: '\\', |
10 | | - } |
11 | | -}) |
12 | | - |
13 | 4 | describe('Model Directory', () => { |
14 | 5 | test('should create directory with nested atrifacts', () => { |
15 | 6 | const directory = new ModelDirectory(getFakePayloadDirectoryWithChildren()) |
@@ -38,22 +29,6 @@ describe('Model Directory', () => { |
38 | 29 | expect(folder3).toBeTruthy() |
39 | 30 | expect(folder3?.level).toBe(4) |
40 | 31 | }) |
41 | | - |
42 | | - test('should find parent by path', () => { |
43 | | - const directory = new ModelDirectory(getFakePayloadDirectoryWithChildren()) |
44 | | - |
45 | | - let found = ModelDirectory.findParentByPath(directory, '') |
46 | | - |
47 | | - expect(found).toBe(directory) |
48 | | - expect(found?.path).toBe('') |
49 | | - expect(found?.level).toBe(0) |
50 | | - |
51 | | - found = ModelDirectory.findParentByPath(directory, 'test\\folder_1') |
52 | | - |
53 | | - expect(found).toBe(directory.directories[0]?.directories[0]) |
54 | | - expect(found?.path).toBe('test\\folder_1') |
55 | | - expect(found?.level).toBe(2) |
56 | | - }) |
57 | 32 | }) |
58 | 33 |
|
59 | 34 | function getFakePayloadDirectoryWithChildren(): any { |
|
0 commit comments