Skip to content

Commit

Permalink
test: employ vitest and add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Jan 15, 2024
1 parent 1d5227f commit e359d2a
Show file tree
Hide file tree
Showing 3 changed files with 865 additions and 6 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"prettify": "prettier --cache --color --write \"**/{.*/,}*.{cjs,css,cts,htm,html,js,json,json5,jsx,md,mjs,mts,scss,ts,tsx,vue,yaml,yml}\" \"!**/test-fixtures/**\"",
"start": "next dev",
"start-prod": "next start",
"test": "vitest tests",
"test/ci-setup": "wb prisma reset",
"typecheck": "wb typecheck"
},
Expand Down Expand Up @@ -81,7 +82,8 @@
"prettier": "3.1.1",
"prisma": "5.8.0",
"sort-package-json": "2.6.0",
"typescript": "5.3.3"
"typescript": "5.3.3",
"vitest": "1.2.0"
},
"packageManager": "[email protected]",
"publishConfig": {
Expand Down
16 changes: 16 additions & 0 deletions tests/problemData.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect, test } from 'vitest';

import { generateProgram } from '../src/problems/problemData';

test.each([
{
programId: 'straight',
languageId: 'js',
},
{
programId: 'curve',
languageId: 'java',
},
])('Get a program by program and language ids', ({ languageId, programId }) => {
expect(generateProgram(programId, languageId)).not.toBeFalsy();
});
Loading

0 comments on commit e359d2a

Please sign in to comment.