-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: slim down npm package; test: introduce tests to package
- Loading branch information
Showing
8 changed files
with
580 additions
and
11 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,3 +1,5 @@ | ||
|
||
node_modules/ | ||
dist/ | ||
test/ | ||
coverage/ |
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,2 +1,11 @@ | ||
|
||
node_modules/ | ||
.github/ | ||
src/ | ||
coverage/ | ||
.prettierignore | ||
README.md | ||
eslint.config.js | ||
prettier.config.js | ||
vitest.config.js | ||
tsconfig.json |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { describe, it, expectTypeOf, expect } from 'vitest'; | ||
|
||
import { getCwd, cleanupPath, directoryScanner, fileExists } from './filerouterscanner'; | ||
|
||
describe('file router scanner', () => { | ||
it('test cwd', () => { | ||
const directory = getCwd(); | ||
|
||
expectTypeOf(directory).toMatchTypeOf('pathstring'); | ||
}); | ||
|
||
it('test cleanup path', () => { | ||
expect(cleanupPath('/./')).toBe('/'); | ||
expect(cleanupPath('\\')).toBe('/'); | ||
}); | ||
|
||
it('scans directories', () => { | ||
const listOfFiles = directoryScanner('./src'); | ||
const filtered = listOfFiles.filter((file) => file.name === 'filerouterscanner.ts'); | ||
expect(filtered[0].name).toBe('filerouterscanner.ts'); | ||
}); | ||
|
||
it('checks for existing file', () => { | ||
expect(fileExists('./src/filerouterscanner.ts')).toBe(true); | ||
expect(fileExists('./src/thisfiledoesnotexistandwillneverbe')).toBe(false); | ||
}); | ||
|
||
it.todo('test filerouterscanner'); | ||
}); |
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
|
||
import { createHandler } from './routegenerator'; | ||
|
||
describe('route generator', () => { | ||
it('test route generator', () => { | ||
const PROMISE = createHandler((context) => { | ||
return context.json({ hello: 'world' }); | ||
}); | ||
expect(Array.isArray(PROMISE)).toBe(true); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
export default defineConfig({ | ||
test: { | ||
coverage: { | ||
provider: 'istanbul', | ||
include: ['./src/**/*'], | ||
enabled: true, | ||
}, | ||
}, | ||
}); |