test: add cart-notifications store tests

This commit is contained in:
Kirill
2026-05-25 17:18:31 +05:00
parent 9f5c2f8637
commit 4aba164c78
@@ -0,0 +1,23 @@
import { allSettled, fork } from 'effector'
import { describe, it, expect } from 'vitest'
import { $cartSnackOpen, cartAdded, cartDismissed } from '../cart-notifications'
describe('cart-notifications store', () => {
it('opens on cartAdded', async () => {
const scope = fork()
await allSettled(cartAdded, { scope })
expect(scope.getState($cartSnackOpen)).toBe(true)
})
it('closes on cartDismissed', async () => {
const scope = fork()
await allSettled(cartAdded, { scope })
await allSettled(cartDismissed, { scope })
expect(scope.getState($cartSnackOpen)).toBe(false)
})
it('starts closed by default', () => {
const scope = fork()
expect(scope.getState($cartSnackOpen)).toBe(false)
})
})