Skip to content

Commit

Permalink
Update our testing implementation to reflect the project's new shinin…
Browse files Browse the repository at this point in the history
…ess!

    add test suite for Tree UI component

    add test for clicking boolean node

    rename main.tsx to index.tsx (to help id that this is the main entrypoint)

    rename main.tsx to index.tsx (to help id that this is the main entrypoint)

    add test for 'showNode' function returned from useTreeNode custom hook

    add unit test for hideDescendantNodes utils function

    update test coverage exclusions

    add coverage script and dependencies and update useTreeNodes test suite
  • Loading branch information
dpgraham4401 committed Jan 26, 2024
1 parent e7a2751 commit c32df27
Show file tree
Hide file tree
Showing 16 changed files with 450 additions and 67 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tsconfig.tsbuildinfo
node_modules
dist
build
coverage
dist-ssr
*.local

Expand Down
18 changes: 9 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The Manifest Game</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The Manifest Game</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
189 changes: 189 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"type": "module",
"scripts": {
"dev": "vite",
"test": "vitest",
"test": "vitest --run",
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
Expand All @@ -27,6 +29,7 @@
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^1.2.2",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
Expand Down
5 changes: 5 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { useMemo } from 'react';
import { loadTree } from 'services/config/config';
import { jsonDummyTree } from 'services/config/jsonDummyTree';

/**
* App - responsible for rendering the decision tree
* Future work - add a spinner, error handling, and a way to load a tree from (multiple) files
* @constructor
*/
export default function App() {
const decisionTree = useMemo(() => loadTree(jsonDummyTree), []);
const { nodes, edges, onClick } = useDecisionTree(decisionTree);
Expand Down
Loading

0 comments on commit c32df27

Please sign in to comment.