How to use the @magento/peregrine/lib/talons/CategoryList/useCategoryList.useCategoryList.mockReturnValue 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 / CategoryList / __tests__ / categoryList.spec.js View on Github external
useCategoryTile: jest.fn()
    };
});

jest.mock('@magento/peregrine/lib/talons/CategoryList/useCategoryList', () => {
    return {
        useCategoryList: jest.fn()
    };
});

useCategoryTile.mockReturnValue({
    image: {},
    item: {}
});

useCategoryList.mockReturnValue({
    data: {
        category: {
            children: []
        }
    },
    loading: false,
    error: false
});

test('renders a header', () => {
    const title = 'foo';
    const { root } = createTestInstance();

    const list = root.findByProps({ className: 'root' });
    const header = list.findByProps({ className: 'header' });