-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ckastbjerg/add-basic-tests
Add basic tests
- Loading branch information
Showing
17 changed files
with
35 additions
and
7 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
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
18 changes: 18 additions & 0 deletions
18
src/plugin/generateTypeScriptFile/__snapshots__/generateTypeScriptFile.test.ts.snap
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,18 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`plugin/generateTypeScriptFile works as expected 1`] = ` | ||
"/* eslint no-use-before-define: 0 */ // --> OFF | ||
// prettier-ignore | ||
// IMPORTANT! This file is autogenerated by the \`type-safe-next-routes\` | ||
// package. You should _not_ update these types manually... | ||
declare module \\"next-type-safe-routes\\" { | ||
export type TypeSafePage = \\"/404\\" | \\"/\\" | { route: \\"/users/[userId]\\", userId: string | string[] | number } | \\"/users\\"; | ||
export type TypeSafeApiRoute = { route: \\"/api/[authId]\\", authId: string | string[] | number } | { route: \\"/api/users/[userId]\\", userId: string | string[] | number } | \\"/api/users\\"; | ||
export const getPathname = (typeSafeUrl: TypeSafePage | TypeSafeApiRoute) => string; | ||
export const getRoute = (typeSafeUrl: TypeSafePage | TypeSafeApiRoute, query?: any) => string; | ||
} | ||
" | ||
`; |
9 changes: 9 additions & 0 deletions
9
src/plugin/generateTypeScriptFile/generateTypeScriptFile.test.ts
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,9 @@ | ||
import generateTypeScriptFile from "./index"; | ||
|
||
const pagesDir = __dirname + "/mocks/pages"; | ||
|
||
describe("plugin/generateTypeScriptFile", () => { | ||
it("works as expected", () => { | ||
expect(generateTypeScriptFile(pagesDir)).toMatchSnapshot(); | ||
}); | ||
}); |
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
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
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.