How to use the @magento/peregrine.createTestInstance 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 / Checkout / __tests__ / paymentsForm.spec.js View on Github external
test('renders a PaymentsForm component', () => {
    const component = createTestInstance();

    expect(component.toJSON()).toMatchSnapshot();
});
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-concept / src / components / ProductImageCarousel / __tests__ / thumbnailList.spec.js View on Github external
test('renders the ThumbnailList component correctly', () => {
    const component = createTestInstance(
        
            
        
    );

    expect(component.toJSON()).toMatchSnapshot();
});
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-ui / lib / components / Checkout / __tests__ / overview.spec.js View on Github external
test('Confirm Order button is disabled if submitting', () => {
    const props = {
        ...defaultProps,
        submitting: true
    };
    const component = createTestInstance();
    expect(component.toJSON()).toMatchSnapshot();
});
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-ui / lib / components / Checkout / __tests__ / editableForm.spec.js View on Github external
test('submit address form calls action with type and values', () => {
    const props = {
        ...defaultProps,
        editing: 'address'
    };
    const component = createTestInstance();
    const formValues = {
        foo: 'bar'
    };
    act(() => {
        component.root.findByType(AddressForm).props.onSubmit(formValues);
    });

    expect(mockSubmitShippingAddress).toHaveBeenCalledWith({
        formValues
    });
});
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-concept / src / components / ProductImageCarousel / __tests__ / carousel.spec.js View on Github external
test('renders the Carousel component correctly w/ sorted images', () => {
    const component = createTestInstance(
        
            
        
    );

    expect(component.toJSON()).toMatchSnapshot();
});
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-ui / lib / components / Checkout / __tests__ / overview.spec.js View on Github external
test('clicking payment form edit sets `editing` state value to "paymentMethod"', () => {
    const component = createTestInstance();

    act(() => {
        component.root.findAllByType(Section)[1].props.onClick();
    });

    expect(mockSetEditing).toHaveBeenCalledWith('paymentMethod');
});
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-ui / lib / RootComponents / Category / __tests__ / categoryContent.spec.js View on Github external
test('renders the correct tree', () => {
    const instance = createTestInstance(
        
    );

    expect(instance.toJSON()).toMatchSnapshot();
});
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-concept / src / components / ProductImageCarousel / __tests__ / thumbnail.spec.js View on Github external
test('clicking calls click handler with item index', () => {
    const component = createTestInstance(
        
            
        
    );

    component.root.findByType('button').props.onClick();

    expect(onClickHandler).toHaveBeenCalledWith(itemIndex);

    onClickHandler.mockClear();
});
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-ui / lib / components / Checkout / __tests__ / editableForm.spec.js View on Github external
test('renders an null Editable Form component', () => {
    const component = createTestInstance();

    expect(component.toJSON()).toMatchSnapshot();
});
github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / venia-ui / lib / components / Checkout / __tests__ / paymentsForm.spec.js View on Github external
test('renders billing address fields if addresses_same checkbox unchecked', () => {
    const props = {
        ...defaultProps,
        initialValues: {
            sameAsShippingAddress: false
        }
    };
    const component = createTestInstance();
    expect(component.toJSON()).toMatchSnapshot();
    expect(component.root.findByProps({ className: 'street0' })).toBeTruthy();
});