Skip to content

Commit

Permalink
Add failing inspect test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkpiano committed Sep 20, 2024
1 parent dada479 commit 8a6e30e
Show file tree
Hide file tree
Showing 3 changed files with 1,863 additions and 1,819 deletions.
1 change: 1 addition & 0 deletions packages/xstate-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"url": "https://github.com/statelyai/xstate/issues"
},
"devDependencies": {
"@statelyai/inspect": "^0.4.0",
"@testing-library/react": "^16.0.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
Expand Down
14 changes: 14 additions & 0 deletions packages/xstate-store/test/store.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { produce } from 'immer';
import { createStore, createStoreWithProducer } from '../src/index.ts';
import { createBrowserInspector } from '@statelyai/inspect';

it('updates a store with an event without mutating original context', () => {
const context = { count: 0 };
Expand Down Expand Up @@ -241,6 +242,19 @@ it('can be inspected', () => {
]);
});

it('inspection with @statelyai/inspect typechecks correctly', () => {
const store = createStore({
context: {},
on: {}
});

const inspector = createBrowserInspector({
autoStart: false
});

store.inspect(inspector.inspect);

Check failure on line 255 in packages/xstate-store/test/store.test.ts

View workflow job for this annotation

GitHub Actions / build

Argument of type 'Observer<InspectionEvent>' is not assignable to parameter of type 'Observer<InspectionEvent> | ((inspectionEvent: InspectionEvent) => void)'.
});

it('emitted events can be subscribed to', () => {
const store = createStore({
types: {
Expand Down
Loading

0 comments on commit 8a6e30e

Please sign in to comment.