mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
Add testing for TS modules
This commit is contained in:
parent
c7d4902137
commit
6bb034ae51
|
@ -33,6 +33,9 @@ This readme file is used mostly to document project dependencies
|
|||
<pre>
|
||||
- tailwindcss postcss autoprefixer
|
||||
- eslint-plugin-simple-import-sort
|
||||
- jest
|
||||
- ts-jest
|
||||
- @types/jest
|
||||
</pre>
|
||||
</details>
|
||||
<details>
|
||||
|
|
|
@ -6,3 +6,7 @@ $djangoSrc = "$PSScriptRoot\backend\manage.py"
|
|||
|
||||
& $pyExec $djangoSrc check
|
||||
& $pyExec $djangoSrc test
|
||||
|
||||
Set-Location $PSScriptRoot\frontend
|
||||
|
||||
& npm test
|
3630
rsconcept/frontend/package-lock.json
generated
3630
rsconcept/frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -4,6 +4,7 @@
|
|||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
|
@ -26,6 +27,7 @@
|
|||
"reagraph": "^4.11.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/node": "^20.4.5",
|
||||
"@types/react": "^18.2.15",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
|
@ -37,9 +39,21 @@
|
|||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.3",
|
||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||
"jest": "^29.6.2",
|
||||
"postcss": "^8.4.27",
|
||||
"tailwindcss": "^3.3.3",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.0.2",
|
||||
"vite": "^4.4.5"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
"testEnvironment": "node",
|
||||
"transform": {
|
||||
"node_modules/variables/.+\\.(j|t)sx?$": "ts-jest"
|
||||
},
|
||||
"transformIgnorePatterns": [
|
||||
"node_modules/(?!variables/.*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
17
rsconcept/frontend/src/utils/Graph.test.ts
Normal file
17
rsconcept/frontend/src/utils/Graph.test.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { Graph } from './Graph';
|
||||
|
||||
describe('Testing Graph constuction', () => {
|
||||
test('empty Graph should be empty', () => {
|
||||
const graph = new Graph();
|
||||
expect(graph.nodes.size).toBe(0);
|
||||
});
|
||||
|
||||
test('adding edges should create nodes', () => {
|
||||
const graph = new Graph();
|
||||
graph.addEdge(13, 37);
|
||||
expect([... graph.nodes.keys()]).toStrictEqual([13, 37]);
|
||||
|
||||
graph.addEdge(13, 38);
|
||||
expect([... graph.nodes.keys()]).toStrictEqual([13, 37, 38]);
|
||||
});
|
||||
});
|
|
@ -5,6 +5,7 @@
|
|||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
|
|
Loading…
Reference in New Issue
Block a user