Skip to content

Commit

Permalink
Fix test where key was clashing with other test
Browse files Browse the repository at this point in the history
  • Loading branch information
joshnuss committed Jan 4, 2024
1 parent d77aeaa commit 91760bd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/localStorageStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,13 @@ describe('persisted()', () => {
})

it("doesn't update store when there are no subscribers", () => {
const store = persisted('myKey', 1)
localStorage.setItem('myKeyb', '2')

const store = persisted('myKeyb', 1)
const values: number[] = []

const event = new StorageEvent('storage', {key: 'myKey', newValue: '2'})
const event = new StorageEvent('storage', {key: 'myKeyb', newValue: '2'})
window.dispatchEvent(event)
localStorage.setItem('myKey', '2')

const unsub = store.subscribe((value: number) => {
values.push(value)
Expand Down

0 comments on commit 91760bd

Please sign in to comment.