Skip to content

Commit

Permalink
test: check booleans as well (#37)
Browse files Browse the repository at this point in the history
- so all the most basic primitives are covered now (string, number, boolean)
  - checks against an issue report as well
  • Loading branch information
agilgur5 authored Jul 19, 2023
1 parent 9442279 commit 1e2af1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"build": "tsdx build",
"tsc": "tsc --noEmit --skipLibCheck",
"test": "tsdx test",
"test:watch": "tsdx test --watch",
"test:coverage": "tsdx test --coverage",
"test:pub": "npm run build && npm pack",
"pub": "npm run build && npm publish",
Expand Down
6 changes: 4 additions & 2 deletions test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { types } from 'mobx-state-tree'

export const UserStoreF = types.model('UserStore', {
name: 'John Doe',
age: 32
age: 32,
hasDogs: true,
}).actions((self) => ({
changeName(name: string) {
self.name = name
Expand All @@ -11,5 +12,6 @@ export const UserStoreF = types.model('UserStore', {

export const persistedDataF = {
name: 'Persisted Name',
age: 35
age: 35,
hasDogs: false,
}
2 changes: 1 addition & 1 deletion test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('persist options', () => {
it('should whitelist', async () => {
const user = UserStoreF.create()
await persist('user', user, {
whitelist: ['name']
whitelist: ['name', 'hasDogs']
})

user.changeName('Joe') // fire action to trigger onSnapshot
Expand Down

0 comments on commit 1e2af1f

Please sign in to comment.