Skip to content

Commit

Permalink
feat: jest support plus one starter test
Browse files Browse the repository at this point in the history
  • Loading branch information
subfuzion committed Mar 7, 2023
1 parent d716af6 commit fd8b23c
Show file tree
Hide file tree
Showing 7 changed files with 6,479 additions and 2,164 deletions.
18 changes: 18 additions & 0 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,21 @@ A sample [API route](https://nextjs.org/docs/api-routes/introduction) can be acc

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

## Tests

```bash
npm test
npm run test:watch
# or
yarn test
yarn test:watch
# or
pnpm test
pnpm test:watch
```

[ts-jest](https://kulshekhar.github.io/ts-jest/) is installed as a dev
dependency to support writing tests in TypeScript. The jest configuration
(`jest.config.js`) sets `preset: 'ts-jest'` to enable this.

Initial test example is located at `src/lib/__test__/database.test.ts`.
5 changes: 5 additions & 0 deletions app/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
Loading

0 comments on commit fd8b23c

Please sign in to comment.