Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: check booleans as well #37

Merged
merged 1 commit into from
Jul 19, 2023
Merged
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
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