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>
|
<pre>
|
||||||
- tailwindcss postcss autoprefixer
|
- tailwindcss postcss autoprefixer
|
||||||
- eslint-plugin-simple-import-sort
|
- eslint-plugin-simple-import-sort
|
||||||
|
- jest
|
||||||
|
- ts-jest
|
||||||
|
- @types/jest
|
||||||
</pre>
|
</pre>
|
||||||
</details>
|
</details>
|
||||||
<details>
|
<details>
|
||||||
|
|
|
@ -6,3 +6,7 @@ $djangoSrc = "$PSScriptRoot\backend\manage.py"
|
||||||
|
|
||||||
& $pyExec $djangoSrc check
|
& $pyExec $djangoSrc check
|
||||||
& $pyExec $djangoSrc test
|
& $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",
|
"version": "0.1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"test": "jest",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
"reagraph": "^4.11.1"
|
"reagraph": "^4.11.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/jest": "^29.5.3",
|
||||||
"@types/node": "^20.4.5",
|
"@types/node": "^20.4.5",
|
||||||
"@types/react": "^18.2.15",
|
"@types/react": "^18.2.15",
|
||||||
"@types/react-dom": "^18.2.7",
|
"@types/react-dom": "^18.2.7",
|
||||||
|
@ -37,9 +39,21 @@
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.3",
|
"eslint-plugin-react-refresh": "^0.4.3",
|
||||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||||
|
"jest": "^29.6.2",
|
||||||
"postcss": "^8.4.27",
|
"postcss": "^8.4.27",
|
||||||
"tailwindcss": "^3.3.3",
|
"tailwindcss": "^3.3.3",
|
||||||
|
"ts-jest": "^29.1.1",
|
||||||
"typescript": "^5.0.2",
|
"typescript": "^5.0.2",
|
||||||
"vite": "^4.4.5"
|
"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"],
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
|
||||||
/* Bundler mode */
|
/* Bundler mode */
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user