Skip to content

Commit ddafd67

Browse files
test(types): add tests
1 parent c1be8fe commit ddafd67

File tree

7 files changed

+606
-6
lines changed

7 files changed

+606
-6
lines changed

packages/types/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
"dist"
1515
],
1616
"scripts": {
17-
"build": "tsc -b"
17+
"build": "tsc -b tsconfig.build.json",
18+
"test": "vitest"
1819
},
1920
"dependencies": {
2021
"zod": "3.23.8"
2122
},
2223
"devDependencies": {
23-
"typescript": "^5.4.5"
24+
"typescript": "^5.4.5",
25+
"vitest": "^1.6.0"
2426
}
2527
}

packages/types/src/files-ref.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { folderPathToFilesRef } from './files-ref.js';
3+
4+
describe('folderPathToFilesRef', () => {
5+
const testCases = [
6+
['path/to/folder', 'path-to-folder.json'],
7+
['path/to///folder', 'path-to-folder.json'],
8+
['files', 'files.json'],
9+
['path/to/folder_2', 'path-to-folder2.json'],
10+
['path\\to\\folder', 'path-to-folder.json'],
11+
['path\\to\\\\\\folder', 'path-to-folder.json'],
12+
];
13+
14+
testCases.forEach(([folderPath, expectedFilesRef]) => {
15+
it(`should return the files ref for a given folder path - ${folderPath}`, () => {
16+
const filesRef = folderPathToFilesRef(folderPath);
17+
18+
expect(filesRef).toBe(expectedFilesRef);
19+
});
20+
});
21+
});

0 commit comments

Comments
 (0)