@pyreon/storage 0.11.5 → 0.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/lib/index.js.map +1 -1
- package/lib/types/index.d.ts +3 -3
- package/package.json +14 -14
- package/src/clear.ts +13 -13
- package/src/cookie.ts +15 -15
- package/src/custom.ts +7 -7
- package/src/index.ts +9 -9
- package/src/indexed-db.ts +16 -16
- package/src/local.ts +12 -12
- package/src/registry.ts +1 -1
- package/src/session.ts +9 -9
- package/src/tests/clear-remove.test.ts +77 -77
- package/src/tests/clear.test.ts +43 -43
- package/src/tests/cookie-options.test.ts +92 -92
- package/src/tests/cookie.test.ts +66 -66
- package/src/tests/cross-tab-sync.test.ts +58 -58
- package/src/tests/custom.test.ts +59 -59
- package/src/tests/indexed-db-debounce.test.ts +43 -43
- package/src/tests/indexed-db.test.ts +36 -36
- package/src/tests/local.test.ts +98 -98
- package/src/tests/memory-storage.test.ts +94 -94
- package/src/tests/session.test.ts +31 -31
- package/src/types.ts +2 -2
- package/src/utils.ts +9 -9
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it } from
|
|
2
|
-
import { _resetRegistry, useCookie } from
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
2
|
+
import { _resetRegistry, useCookie } from '../index'
|
|
3
3
|
|
|
4
4
|
function clearAllCookies(): void {
|
|
5
|
-
for (const cookie of document.cookie.split(
|
|
6
|
-
const name = cookie.split(
|
|
5
|
+
for (const cookie of document.cookie.split(';')) {
|
|
6
|
+
const name = cookie.split('=')[0]?.trim()
|
|
7
7
|
if (name) {
|
|
8
8
|
// biome-ignore lint/suspicious/noDocumentCookie: test cleanup requires direct cookie access
|
|
9
9
|
document.cookie = `${name}=; max-age=0; path=/`
|
|
@@ -11,7 +11,7 @@ function clearAllCookies(): void {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
describe(
|
|
14
|
+
describe('useCookie — options', () => {
|
|
15
15
|
beforeEach(() => {
|
|
16
16
|
_resetRegistry()
|
|
17
17
|
clearAllCookies()
|
|
@@ -22,165 +22,165 @@ describe("useCookie — options", () => {
|
|
|
22
22
|
clearAllCookies()
|
|
23
23
|
})
|
|
24
24
|
|
|
25
|
-
describe(
|
|
26
|
-
it(
|
|
27
|
-
const sig = useCookie(
|
|
28
|
-
sig.set(
|
|
25
|
+
describe('maxAge', () => {
|
|
26
|
+
it('sets cookie with maxAge in seconds', () => {
|
|
27
|
+
const sig = useCookie('session', 'token-abc', { maxAge: 3600 })
|
|
28
|
+
sig.set('token-xyz')
|
|
29
29
|
// Cookie should be written — we can verify the signal value
|
|
30
|
-
expect(sig()).toBe(
|
|
30
|
+
expect(sig()).toBe('token-xyz')
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
-
it(
|
|
34
|
-
const sig = useCookie(
|
|
35
|
-
sig.set(
|
|
36
|
-
expect(sig()).toBe(
|
|
33
|
+
it('maxAge=0 still writes cookie (browser handles expiry)', () => {
|
|
34
|
+
const sig = useCookie('ephemeral', 'val', { maxAge: 0 })
|
|
35
|
+
sig.set('updated')
|
|
36
|
+
expect(sig()).toBe('updated')
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
it(
|
|
39
|
+
it('large maxAge for long-lived cookies', () => {
|
|
40
40
|
const oneYear = 60 * 60 * 24 * 365
|
|
41
|
-
const sig = useCookie(
|
|
42
|
-
sig.set(
|
|
43
|
-
expect(sig()).toBe(
|
|
41
|
+
const sig = useCookie('locale', 'en', { maxAge: oneYear })
|
|
42
|
+
sig.set('de')
|
|
43
|
+
expect(sig()).toBe('de')
|
|
44
44
|
})
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
-
describe(
|
|
48
|
-
it(
|
|
49
|
-
const sig = useCookie(
|
|
50
|
-
sig.set(
|
|
51
|
-
expect(sig()).toBe(
|
|
47
|
+
describe('path', () => {
|
|
48
|
+
it('defaults to / when no path specified', () => {
|
|
49
|
+
const sig = useCookie('default-path', 'val')
|
|
50
|
+
sig.set('updated')
|
|
51
|
+
expect(sig()).toBe('updated')
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
-
it(
|
|
55
|
-
const sig = useCookie(
|
|
56
|
-
sig.set(
|
|
57
|
-
expect(sig()).toBe(
|
|
54
|
+
it('accepts custom path', () => {
|
|
55
|
+
const sig = useCookie('scoped', 'val', { path: '/admin' })
|
|
56
|
+
sig.set('updated')
|
|
57
|
+
expect(sig()).toBe('updated')
|
|
58
58
|
})
|
|
59
59
|
})
|
|
60
60
|
|
|
61
|
-
describe(
|
|
62
|
-
it(
|
|
63
|
-
const sig = useCookie(
|
|
64
|
-
sig.set(
|
|
65
|
-
expect(sig()).toBe(
|
|
61
|
+
describe('sameSite', () => {
|
|
62
|
+
it('defaults to lax when not specified', () => {
|
|
63
|
+
const sig = useCookie('lax-default', 'val')
|
|
64
|
+
sig.set('updated')
|
|
65
|
+
expect(sig()).toBe('updated')
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
-
it(
|
|
69
|
-
const sig = useCookie(
|
|
70
|
-
sig.set(
|
|
71
|
-
expect(sig()).toBe(
|
|
68
|
+
it('accepts strict sameSite', () => {
|
|
69
|
+
const sig = useCookie('strict-cookie', 'val', { sameSite: 'strict' })
|
|
70
|
+
sig.set('updated')
|
|
71
|
+
expect(sig()).toBe('updated')
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
it(
|
|
75
|
-
const sig = useCookie(
|
|
76
|
-
sig.set(
|
|
77
|
-
expect(sig()).toBe(
|
|
74
|
+
it('accepts none sameSite', () => {
|
|
75
|
+
const sig = useCookie('none-cookie', 'val', { sameSite: 'none', secure: true })
|
|
76
|
+
sig.set('updated')
|
|
77
|
+
expect(sig()).toBe('updated')
|
|
78
78
|
})
|
|
79
79
|
|
|
80
|
-
it(
|
|
81
|
-
const sig = useCookie(
|
|
82
|
-
sig.set(
|
|
83
|
-
expect(sig()).toBe(
|
|
80
|
+
it('accepts lax sameSite explicitly', () => {
|
|
81
|
+
const sig = useCookie('explicit-lax', 'val', { sameSite: 'lax' })
|
|
82
|
+
sig.set('updated')
|
|
83
|
+
expect(sig()).toBe('updated')
|
|
84
84
|
})
|
|
85
85
|
})
|
|
86
86
|
|
|
87
|
-
describe(
|
|
88
|
-
it(
|
|
89
|
-
const sig = useCookie(
|
|
87
|
+
describe('combined options', () => {
|
|
88
|
+
it('maxAge + path + sameSite together', () => {
|
|
89
|
+
const sig = useCookie('combined', 'default', {
|
|
90
90
|
maxAge: 86400,
|
|
91
|
-
path:
|
|
92
|
-
sameSite:
|
|
91
|
+
path: '/app',
|
|
92
|
+
sameSite: 'strict',
|
|
93
93
|
})
|
|
94
|
-
sig.set(
|
|
95
|
-
expect(sig()).toBe(
|
|
94
|
+
sig.set('updated')
|
|
95
|
+
expect(sig()).toBe('updated')
|
|
96
96
|
sig.remove()
|
|
97
|
-
expect(sig()).toBe(
|
|
97
|
+
expect(sig()).toBe('default')
|
|
98
98
|
})
|
|
99
99
|
|
|
100
|
-
it(
|
|
100
|
+
it('expires + domain + secure together', () => {
|
|
101
101
|
const future = new Date(Date.now() + 86400000)
|
|
102
|
-
const sig = useCookie(
|
|
102
|
+
const sig = useCookie('full-options', 'val', {
|
|
103
103
|
expires: future,
|
|
104
|
-
domain:
|
|
104
|
+
domain: 'example.com',
|
|
105
105
|
secure: true,
|
|
106
|
-
sameSite:
|
|
106
|
+
sameSite: 'none',
|
|
107
107
|
})
|
|
108
|
-
sig.set(
|
|
109
|
-
expect(sig()).toBe(
|
|
108
|
+
sig.set('updated')
|
|
109
|
+
expect(sig()).toBe('updated')
|
|
110
110
|
})
|
|
111
111
|
|
|
112
|
-
it(
|
|
113
|
-
const sig = useCookie(
|
|
112
|
+
it('all options combined', () => {
|
|
113
|
+
const sig = useCookie('all-opts', 'val', {
|
|
114
114
|
maxAge: 7200,
|
|
115
|
-
path:
|
|
116
|
-
domain:
|
|
115
|
+
path: '/dashboard',
|
|
116
|
+
domain: 'example.com',
|
|
117
117
|
secure: true,
|
|
118
|
-
sameSite:
|
|
118
|
+
sameSite: 'strict',
|
|
119
119
|
})
|
|
120
|
-
sig.set(
|
|
121
|
-
expect(sig()).toBe(
|
|
120
|
+
sig.set('new-val')
|
|
121
|
+
expect(sig()).toBe('new-val')
|
|
122
122
|
})
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
-
describe(
|
|
126
|
-
it(
|
|
127
|
-
const sig = useCookie(
|
|
125
|
+
describe('custom serializer/deserializer', () => {
|
|
126
|
+
it('uses custom serializer for cookie writes', () => {
|
|
127
|
+
const sig = useCookie('date-cookie', new Date('2025-01-01'), {
|
|
128
128
|
serializer: (d) => d.toISOString(),
|
|
129
129
|
deserializer: (s) => new Date(s),
|
|
130
130
|
})
|
|
131
|
-
const newDate = new Date(
|
|
131
|
+
const newDate = new Date('2025-06-15')
|
|
132
132
|
sig.set(newDate)
|
|
133
|
-
expect(sig().toISOString()).toBe(
|
|
133
|
+
expect(sig().toISOString()).toBe('2025-06-15T00:00:00.000Z')
|
|
134
134
|
})
|
|
135
135
|
})
|
|
136
136
|
|
|
137
|
-
describe(
|
|
138
|
-
it(
|
|
139
|
-
const sig = useCookie(
|
|
137
|
+
describe('remove with options', () => {
|
|
138
|
+
it('remove() resets signal regardless of cookie options', () => {
|
|
139
|
+
const sig = useCookie('removable', 'default', {
|
|
140
140
|
maxAge: 86400,
|
|
141
|
-
path:
|
|
142
|
-
domain:
|
|
141
|
+
path: '/app',
|
|
142
|
+
domain: 'example.com',
|
|
143
143
|
})
|
|
144
|
-
sig.set(
|
|
144
|
+
sig.set('changed')
|
|
145
145
|
sig.remove()
|
|
146
|
-
expect(sig()).toBe(
|
|
146
|
+
expect(sig()).toBe('default')
|
|
147
147
|
})
|
|
148
148
|
|
|
149
|
-
it(
|
|
150
|
-
const a = useCookie(
|
|
151
|
-
a.set(
|
|
149
|
+
it('after remove(), a new useCookie call creates a fresh signal', () => {
|
|
150
|
+
const a = useCookie('temp-cookie', 'first')
|
|
151
|
+
a.set('modified')
|
|
152
152
|
a.remove()
|
|
153
153
|
|
|
154
|
-
const b = useCookie(
|
|
155
|
-
expect(b()).toBe(
|
|
154
|
+
const b = useCookie('temp-cookie', 'second')
|
|
155
|
+
expect(b()).toBe('second')
|
|
156
156
|
expect(a).not.toBe(b)
|
|
157
157
|
})
|
|
158
158
|
})
|
|
159
159
|
|
|
160
|
-
describe(
|
|
161
|
-
it(
|
|
160
|
+
describe('onError callback', () => {
|
|
161
|
+
it('calls onError when deserialization fails', () => {
|
|
162
162
|
// Pre-seed a corrupt cookie
|
|
163
163
|
// biome-ignore lint/suspicious/noDocumentCookie: test setup
|
|
164
|
-
document.cookie = `broken-cookie=${encodeURIComponent(
|
|
164
|
+
document.cookie = `broken-cookie=${encodeURIComponent('{invalid json')}; path=/`
|
|
165
165
|
|
|
166
166
|
const errors: Error[] = []
|
|
167
|
-
const sig = useCookie(
|
|
167
|
+
const sig = useCookie('broken-cookie', 'fallback', {
|
|
168
168
|
onError: (e) => {
|
|
169
169
|
errors.push(e)
|
|
170
170
|
return undefined
|
|
171
171
|
},
|
|
172
172
|
})
|
|
173
|
-
expect(sig()).toBe(
|
|
173
|
+
expect(sig()).toBe('fallback')
|
|
174
174
|
expect(errors).toHaveLength(1)
|
|
175
175
|
})
|
|
176
176
|
|
|
177
|
-
it(
|
|
177
|
+
it('onError can provide custom fallback', () => {
|
|
178
178
|
// biome-ignore lint/suspicious/noDocumentCookie: test setup
|
|
179
|
-
document.cookie = `bad-cookie=${encodeURIComponent(
|
|
180
|
-
const sig = useCookie(
|
|
181
|
-
onError: () =>
|
|
179
|
+
document.cookie = `bad-cookie=${encodeURIComponent('not-json{')}`
|
|
180
|
+
const sig = useCookie('bad-cookie', 'default', {
|
|
181
|
+
onError: () => 'custom-fallback',
|
|
182
182
|
})
|
|
183
|
-
expect(sig()).toBe(
|
|
183
|
+
expect(sig()).toBe('custom-fallback')
|
|
184
184
|
})
|
|
185
185
|
})
|
|
186
186
|
})
|
package/src/tests/cookie.test.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it } from
|
|
2
|
-
import { _resetRegistry, setCookieSource, useCookie } from
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
2
|
+
import { _resetRegistry, setCookieSource, useCookie } from '../index'
|
|
3
3
|
|
|
4
4
|
function clearAllCookies(): void {
|
|
5
|
-
for (const cookie of document.cookie.split(
|
|
6
|
-
const name = cookie.split(
|
|
5
|
+
for (const cookie of document.cookie.split(';')) {
|
|
6
|
+
const name = cookie.split('=')[0]?.trim()
|
|
7
7
|
if (name) {
|
|
8
8
|
// biome-ignore lint/suspicious/noDocumentCookie: test cleanup requires direct cookie access
|
|
9
9
|
document.cookie = `${name}=; max-age=0; path=/`
|
|
@@ -11,7 +11,7 @@ function clearAllCookies(): void {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
describe(
|
|
14
|
+
describe('useCookie', () => {
|
|
15
15
|
beforeEach(() => {
|
|
16
16
|
_resetRegistry()
|
|
17
17
|
clearAllCookies()
|
|
@@ -22,128 +22,128 @@ describe("useCookie", () => {
|
|
|
22
22
|
clearAllCookies()
|
|
23
23
|
})
|
|
24
24
|
|
|
25
|
-
it(
|
|
26
|
-
const locale = useCookie(
|
|
27
|
-
expect(locale()).toBe(
|
|
25
|
+
it('returns default value when cookie does not exist', () => {
|
|
26
|
+
const locale = useCookie('locale', 'en')
|
|
27
|
+
expect(locale()).toBe('en')
|
|
28
28
|
})
|
|
29
29
|
|
|
30
|
-
it(
|
|
30
|
+
it('reads existing cookie value', () => {
|
|
31
31
|
// biome-ignore lint/suspicious/noDocumentCookie: test setup requires direct cookie access
|
|
32
|
-
document.cookie = `locale=${encodeURIComponent(JSON.stringify(
|
|
33
|
-
const locale = useCookie(
|
|
34
|
-
expect(locale()).toBe(
|
|
32
|
+
document.cookie = `locale=${encodeURIComponent(JSON.stringify('de'))}; path=/`
|
|
33
|
+
const locale = useCookie('locale', 'en')
|
|
34
|
+
expect(locale()).toBe('de')
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
-
it(
|
|
38
|
-
const locale = useCookie(
|
|
39
|
-
locale.set(
|
|
40
|
-
expect(locale()).toBe(
|
|
41
|
-
expect(document.cookie).toContain(
|
|
37
|
+
it('.set() updates signal and writes cookie', () => {
|
|
38
|
+
const locale = useCookie('locale', 'en')
|
|
39
|
+
locale.set('fr')
|
|
40
|
+
expect(locale()).toBe('fr')
|
|
41
|
+
expect(document.cookie).toContain('locale')
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
it(
|
|
45
|
-
const locale = useCookie(
|
|
46
|
-
locale.set(
|
|
44
|
+
it('.remove() deletes cookie and resets to default', () => {
|
|
45
|
+
const locale = useCookie('locale', 'en')
|
|
46
|
+
locale.set('fr')
|
|
47
47
|
locale.remove()
|
|
48
|
-
expect(locale()).toBe(
|
|
48
|
+
expect(locale()).toBe('en')
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
it(
|
|
52
|
-
const a = useCookie(
|
|
53
|
-
const b = useCookie(
|
|
51
|
+
it('returns same signal instance for same key', () => {
|
|
52
|
+
const a = useCookie('locale', 'en')
|
|
53
|
+
const b = useCookie('locale', 'en')
|
|
54
54
|
expect(a).toBe(b)
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
-
it(
|
|
58
|
-
const prefs = useCookie(
|
|
57
|
+
it('works with objects', () => {
|
|
58
|
+
const prefs = useCookie('prefs', { dark: false })
|
|
59
59
|
prefs.set({ dark: true })
|
|
60
60
|
expect(prefs()).toEqual({ dark: true })
|
|
61
61
|
})
|
|
62
62
|
|
|
63
|
-
it(
|
|
64
|
-
const count = useCookie(
|
|
63
|
+
it('.update() works', () => {
|
|
64
|
+
const count = useCookie('count', 0)
|
|
65
65
|
count.update((n) => n + 1)
|
|
66
66
|
expect(count()).toBe(1)
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
-
it(
|
|
70
|
-
const locale = useCookie(
|
|
71
|
-
expect(locale.peek()).toBe(
|
|
69
|
+
it('.peek() reads without subscribing', () => {
|
|
70
|
+
const locale = useCookie('locale', 'en')
|
|
71
|
+
expect(locale.peek()).toBe('en')
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
it(
|
|
75
|
-
const locale = useCookie(
|
|
76
|
-
locale.set(
|
|
77
|
-
expect(document.cookie).toContain(
|
|
74
|
+
it('respects maxAge option', () => {
|
|
75
|
+
const locale = useCookie('locale', 'en', { maxAge: 3600 })
|
|
76
|
+
locale.set('de')
|
|
77
|
+
expect(document.cookie).toContain('locale')
|
|
78
78
|
})
|
|
79
79
|
|
|
80
|
-
it(
|
|
81
|
-
const token = useCookie(
|
|
82
|
-
token.set(
|
|
83
|
-
expect(token()).toBe(
|
|
80
|
+
it('respects secure option', () => {
|
|
81
|
+
const token = useCookie('token', '', { secure: true })
|
|
82
|
+
token.set('abc123')
|
|
83
|
+
expect(token()).toBe('abc123')
|
|
84
84
|
})
|
|
85
85
|
|
|
86
|
-
it(
|
|
86
|
+
it('respects expires option', () => {
|
|
87
87
|
const future = new Date(Date.now() + 86400000)
|
|
88
|
-
const sig = useCookie(
|
|
89
|
-
sig.set(
|
|
90
|
-
expect(sig()).toBe(
|
|
88
|
+
const sig = useCookie('exp', 'val', { expires: future })
|
|
89
|
+
sig.set('updated')
|
|
90
|
+
expect(sig()).toBe('updated')
|
|
91
91
|
})
|
|
92
92
|
|
|
93
|
-
it(
|
|
94
|
-
const sig = useCookie(
|
|
95
|
-
sig.set(
|
|
96
|
-
expect(sig()).toBe(
|
|
93
|
+
it('respects domain option on set and remove', () => {
|
|
94
|
+
const sig = useCookie('dom', 'val', { domain: 'example.com' })
|
|
95
|
+
sig.set('updated')
|
|
96
|
+
expect(sig()).toBe('updated')
|
|
97
97
|
sig.remove()
|
|
98
|
-
expect(sig()).toBe(
|
|
98
|
+
expect(sig()).toBe('val')
|
|
99
99
|
})
|
|
100
100
|
|
|
101
|
-
it(
|
|
102
|
-
const sig = useCookie(
|
|
101
|
+
it('.subscribe() works', () => {
|
|
102
|
+
const sig = useCookie('sub', 'a')
|
|
103
103
|
let called = false
|
|
104
104
|
const unsub = sig.subscribe(() => {
|
|
105
105
|
called = true
|
|
106
106
|
})
|
|
107
|
-
sig.set(
|
|
107
|
+
sig.set('b')
|
|
108
108
|
expect(called).toBe(true)
|
|
109
109
|
unsub()
|
|
110
110
|
})
|
|
111
111
|
|
|
112
|
-
it(
|
|
113
|
-
const sig = useCookie(
|
|
112
|
+
it('.direct() works', () => {
|
|
113
|
+
const sig = useCookie('dir', 'a')
|
|
114
114
|
let called = false
|
|
115
115
|
const unsub = sig.direct(() => {
|
|
116
116
|
called = true
|
|
117
117
|
})
|
|
118
|
-
sig.set(
|
|
118
|
+
sig.set('b')
|
|
119
119
|
expect(called).toBe(true)
|
|
120
120
|
unsub()
|
|
121
121
|
})
|
|
122
122
|
|
|
123
|
-
it(
|
|
124
|
-
const sig = useCookie(
|
|
125
|
-
expect(sig.debug().value).toBe(
|
|
123
|
+
it('.debug() returns debug info', () => {
|
|
124
|
+
const sig = useCookie('dbg', 'test')
|
|
125
|
+
expect(sig.debug().value).toBe('test')
|
|
126
126
|
})
|
|
127
127
|
|
|
128
|
-
it(
|
|
129
|
-
const sig = useCookie(
|
|
130
|
-
sig.label =
|
|
131
|
-
expect(sig.label).toBe(
|
|
128
|
+
it('.label can be set and read', () => {
|
|
129
|
+
const sig = useCookie('lbl', 'val')
|
|
130
|
+
sig.label = 'my-cookie'
|
|
131
|
+
expect(sig.label).toBe('my-cookie')
|
|
132
132
|
})
|
|
133
133
|
})
|
|
134
134
|
|
|
135
|
-
describe(
|
|
135
|
+
describe('setCookieSource (SSR)', () => {
|
|
136
136
|
beforeEach(() => {
|
|
137
137
|
_resetRegistry()
|
|
138
138
|
})
|
|
139
139
|
|
|
140
140
|
afterEach(() => {
|
|
141
141
|
_resetRegistry()
|
|
142
|
-
setCookieSource(
|
|
142
|
+
setCookieSource('')
|
|
143
143
|
})
|
|
144
144
|
|
|
145
|
-
it(
|
|
146
|
-
setCookieSource(
|
|
147
|
-
expect(() => setCookieSource(
|
|
145
|
+
it('stores server cookie string without throwing', () => {
|
|
146
|
+
setCookieSource('locale=de; theme=dark')
|
|
147
|
+
expect(() => setCookieSource('foo=bar')).not.toThrow()
|
|
148
148
|
})
|
|
149
149
|
})
|