-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add 1 simple test that just runs the persist function and ensures it doesn't persist anything if an action hasn't been used - change test script to use jest, and move prev test to test:pub - (ci): change CI to run test and test:pub - (deps): add @types/jest to devDeps - also add reference in spec so that the types are loaded properly - not sure why the reference is needed, but it would error without - and plain `import`ing jest or @types/jest would also error
- Loading branch information
Showing
5 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
language: node_js | ||
# default is the very old 0.10.48; match local version instead | ||
node_js: '8.9' | ||
|
||
script: npm test | ||
after_script: npm run test:pub |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { types } from 'mobx-state-tree' | ||
|
||
export const UserStore = types.model('UserStore', { | ||
name: 'John Doe', | ||
age: 32 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference types="@types/jest" /> | ||
|
||
import { persist } from '../src/index' | ||
import { UserStore } from './fixtures' | ||
|
||
describe('initialization', () => { | ||
beforeEach(() => window.localStorage.clear()) | ||
|
||
it('should persist nothing if no actions are used', async () => { | ||
const user = UserStore.create() | ||
await persist('user', user) | ||
|
||
expect(window.localStorage.getItem('user')).toBe(null) | ||
}) | ||
}) |