Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

webmasterdevlin/zustand-immer-react-query-course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

236 Commits

Repository files navigation

Tanstack Query Course with Zustand, Immer, and React Table

There are two versions of this application. One using React Router and one using Tanstack Router

  • Tanstack Router: main branch
  • React Router: using-react-router branch

Tech tools

$ git clone https://github.com/webmasterdevlin/zustand-immer-react-query-course.git
$ cd zustand-immer-react-query-course
$ bun install
$ bun run start

E2e testing

$ npx playwright install
$ bun run test:e2e

The React app, and the fake web service will run concurrently.

screenshot

Vitest

Tanstack Router

  • routeTree.gen.ts is an auto generated route tree

Set up MSW for mocking API calls

  • bun i -D msw
  • the msw is a mocking library which will intercept the requests and responses in the integration tests
  • create ./src/mocks/handler/todoHandler.ts
  • create ./src/mocks/handler/index.ts
  • create ./src/mocks/server.ts
  • update the ./src/setupTests.ts

Integration tests

  • write integration tests for the fetch todos function of WorkTodosPage.tsx by creating ./src/pages/tests/WorkTodosPage.test.ts
  • run the tests, pnpm run test, and see if the todos are rendered

TanStack Query persist cache between tests

  • the beforeEach does not work
beforeEach(() => {
 queryClient.clear();
});

AltStyle によって変換されたページ (->オリジナル) /