- boardStore.js: refactored from per-component useState to a module-level
singleton via useSyncExternalStore. All callers share state (true
singleton). Exposes __resetStore/__setState/__setPersistOnChange for
test isolation. addBoard/addList/addCard still return the new id
(computed from post-action state).
- jest.config.js: added moduleNameMapper for CSS (identity-obj-proxy)
+ transformIgnorePatterns for @dnd-kit ESM modules.
- jest.setup.js: stub window.matchMedia for AppShell, clear localStorage
+ reset store singleton before each test.
- src/test/testUtils.jsx: renderWithStore now wraps the UI in a Host
that calls useBoardStore and clones the child element to inject
{ state, actions } as props. Returns result.state/result.actions
getters so tests can read state and invoke actions from outside.
- src/components/List.test.jsx: Host accepts state/actions props and
falls back to useBoardStore for standalone use.
- src/components/ListHeader.test.jsx + Board.test.jsx: updated to new
result.state API (was store.getState() in P3's API).
- src/App.jsx: final spec wiring — sidebar + board area + TopBar + Board
+ empty states (first-run + select-board). Reads from useBoardStore,
passes state + actions down to AppShell + Board.
- src/App.test.jsx: smoke test — sidebar + topbar + board + lists render
when seeded; +Create board flow creates a board and activates it;
first-run and select-board empty states render correctly; mobile
breakpoint shows hamburger.
All 119 tests pass across 15 suites. npm run build green.
20 lines
659 B
JavaScript
20 lines
659 B
JavaScript
export default {
|
|
testEnvironment: 'jsdom',
|
|
transform: {
|
|
'^.+\\.(js|jsx)$': ['babel-jest', { configFile: './babel.config.js' }],
|
|
},
|
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
testMatch: ['<rootDir>/src/**/*.test.{js,jsx}'],
|
|
moduleFileExtensions: ['js', 'jsx', 'json'],
|
|
testEnvironmentOptions: {
|
|
// jsdom 22+ doesn't ship crypto.randomUUID by default in some envs
|
|
customExportConditions: [''],
|
|
},
|
|
// Stub CSS imports as identity objects so jest doesn't try to parse them.
|
|
moduleNameMapper: {
|
|
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
},
|
|
transformIgnorePatterns: [
|
|
'node_modules/(?!(@dnd-kit)/)',
|
|
],
|
|
}; |