Hello and thanks for taking the time to take this test !
Please do not use ChatGpt, Github Copilot or any equivalent.
The app shows a tree view of files and folder ; however it shows nothing for now.
Tree node are of TreeNode
type
interface TreeNode {
name: string;
children?: TreeNode[];
hidden?: boolean;
}
- Run
npm i
to install all dependencies. - Run
npm run dev
to start dev server and mocked services.
Run npm run test:filterHiddenFiles
run only filterHiddenFiles.test.ts
.
Run npm run test:all
run all units tests in watch mode.
In filterHiddenFiles.ts
and filterHiddenFiles.test.ts
, the test for the function filterHiddenFiles
fails
You are asked to fix the function so the test succeeds.
For this step, please considerate <TreeView>
as a component coming from a 3rd party library. It should not be edited.
- Build
useQueryTreeData
hook to fetch http://localhost:5173/tree. Its return type should match the providedUseQueryTreeDataReturn
.
No worries, the endpoint is already handled via a mocked API service. - Use the query hook in
App.tsx
to inject the data into<TreeView>
so the 1st test inapp.test.ts
succeeds ("renders the tree data correctly"). - Use
filterHiddenFiles
to only display files that are not "hidden". Hence, the 2nd test inapp.test.ts
should succeed ("renders the tree with filtered data")'