Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8ff0244

Browse files
committed
(test): ensure jsonify can be set to false
- previously a bug made it so you couldn't set it to false- this option is an edge case that's mostly useful for certain storage engines like WebSQL, IndexedDB, etc that can actually handle non-string data - for localStorage, objects just get stored as '[object Object]' if they're not jsonified - might want to throw on jsonify = false and localStorage engine?
1 parent1398eae commit8ff0244

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎test/index.spec.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ describe('basic persist options', () => {
2727
expect(getItem('user')).toStrictEqual(getSnapshot(user))
2828
})
2929

30+
it('shouldn\'t jsonify',async()=>{
31+
constuser=UserStore.create()
32+
awaitpersist('user',user,{
33+
jsonify:false
34+
})
35+
36+
user.changeName('Joe')// fire action to trigger onSnapshot
37+
// if not jsonified, localStorage will store as '[object Object]'
38+
expect(window.localStorage.getItem('user')).toBe('[object Object]')
39+
})
40+
3041
it('should whitelist',async()=>{
3142
constuser=UserStore.create()
3243
awaitpersist('user',user,{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp