Skip to content

Commit

Permalink
Add skipped test for future improvement to createFacet.
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonicus committed Jan 17, 2024
1 parent 1ebf535 commit 66bc363
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/@react-facet/core/src/facet/createFacet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,24 @@ describe('setWithCallback', () => {
expect(listenerMock).not.toHaveBeenCalled()
})
})

describe('regressions', () => {
it.skip('only calls initial observer once for a facet with an initialValue and a startSubscription', () => {
const value = 'test-value'
const initialValue = 'initial-value'
const cleanup = jest.fn()
const startSubscription = jest.fn().mockImplementation((update) => {
update(value)
return cleanup
})

const mock = createFacet<string>({ startSubscription, initialValue })

const listener = jest.fn()

mock.observe(listener)

expect(listener).toHaveBeenCalledTimes(1)
expect(listener).toHaveBeenLastCalledWith(value)
})
})

0 comments on commit 66bc363

Please sign in to comment.