UNPKG

@applicaster/zapp-react-native-utils

Version:

Applicaster Zapp React Native utilities package

52 lines (41 loc) 1.2 kB
import { modalStore } from "../"; describe("Modal State", () => { it("should have initial state", () => { const state = modalStore.getState(); expect(state).toMatchObject({ modalState: { visible: false, screen: null, options: {}, props: {}, }, }); expect(state.openModal).toBeDefined(); expect(state.dismissModal).toBeDefined(); }); describe("opening and dismissing modal", () => { it("should open modal", () => { const item = { id: "test", name: "Test Modal" }; const options = { animated: true, animationType: "slide" }; const props = { customProp: "value" }; modalStore.getState().openModal({ item, options, props }); const state = modalStore.getState(); expect(state.modalState).toMatchObject({ visible: true, screen: item, options, props, }); }); it("should dismiss modal", () => { modalStore.getState().dismissModal(); const state = modalStore.getState(); expect(state.modalState).toMatchObject({ visible: false, screen: null, options: {}, props: {}, }); }); }); });