Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bash_history
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn test --coverage --watchAll=false
exit
47,890 changes: 30,263 additions & 17,627 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
"proxy": "http://127.0.0.1:8000",
"dependencies": {
"@reduxjs/toolkit": "1.8.5",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "13.3.0",
"@testing-library/user-event": "13.5.0",
"@types/jest": "27.5.2",
"@types/node": "16.11.56",
"@types/react": "18.0.17",
"@types/react-dom": "18.0.6",
Expand All @@ -18,8 +15,9 @@
"react-redux": "8.0.2",
"react-router": "6.3.0",
"react-router-dom": "6.3.0",
"react-scripts": "5.0.1",
"react-scripts": "^2.1.3",
"redux": "4.2.0",
"testing-library": "^0.0.2",
"typescript": "4.7.4",
"web-vitals": "2.1.4"
},
Expand All @@ -46,5 +44,12 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.1.1",
"handlebars": "^4.5.0",
"jest": "^29.1.2"
}
}
}
16 changes: 13 additions & 3 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
// import { render, screen } from "@testing-library/react";
import React from 'react';
import { render } from "@testing-library/react";
import { Provider } from "react-redux";

import App from "./App";
import { store } from "./store";

test("renders learn react link", () => {
render(<App />);
});
test("renders App.tsx", () => {
render(
<Provider store={store}>
<App />
</Provider>
);
// screen.debug();
//expect(true).toBe(false); // This make failing test case
});
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import TodoList from "./containers/TodoList/TodoList"; // can omit.js
import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
import NewTodo from "./containers/TodoList/NewTodo/NewTodo";
import TodoDetail from "./components/TodoDetail/TodoDetail";
import React from 'react';

function App() {
return (
Expand Down
24 changes: 24 additions & 0 deletions src/components/Todo/Todo.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import { render, screen } from "@testing-library/react";
import Todo from "./Todo";

describe("<Todo />", () => {
it("should render without errors", () => {
render(<Todo title={"TODO_TITLE"} done={false} />);
screen.getByText("TODO_TITLE"); // Implicit assertion
const doneButton = screen.getByText("Done"); // Implicit assertion
expect(doneButton).toBeInTheDocument(); // Explicit assertion
});
it("should render done mark when done is true", () => {
render(<Todo title={"TODO_TITLE"} done={true} />);
const title = screen.getByText("TODO_TITLE");
expect(title.classList.contains("done")).toBe(true);
screen.getByText("Undone");
});
it("should render undone mark when done is false", () => {
render(<Todo title={"TODO_TITLE"} done={false} />);
const title = screen.getByText("TODO_TITLE");
expect(title.classList.contains("done")).toBe(false);
screen.getByText("Done");
});
});
1 change: 1 addition & 0 deletions src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "preserve"
},
"include": [
"src"
Expand Down
20,031 changes: 11,774 additions & 8,257 deletions yarn.lock

Large diffs are not rendered by default.