How to use the @magento/peregrine/lib/context/app.useAppContext.mockReturnValueOnce function in @magento/peregrine

To help you get started, we’ve selected a few @magento/peregrine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-ui / lib / components / App / __tests__ / app.spec.js View on Github external
test('displays open nav or drawer', () => {
    const [appState, appApi] = useAppContext();
    useAppContext
        .mockReturnValueOnce([
            {
                ...appState,
                drawer: 'nav',
                overlay: false,
                hasBeenOffline: true,
                isOnline: true
            },
            appApi
        ])
        .mockReturnValueOnce([
            {
                ...appState,
                drawer: 'cart',
                overlay: false,
                hasBeenOffline: true,
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-ui / lib / components / App / __tests__ / app.spec.js View on Github external
test('displays onlineIndicator online if hasBeenOffline', () => {
    const [appState, appApi] = useAppContext();
    useAppContext.mockReturnValueOnce([
        {
            ...appState,
            drawer: '',
            overlay: false,
            hasBeenOffline: true,
            isOnline: true
        },
        appApi
    ]);

    const appProps = {
        markErrorHandled: jest.fn(),
        unhandledErrors: []
    };

    createTestInstance();