Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('renders a PaymentsForm component', () => {
const component = createTestInstance();
expect(component.toJSON()).toMatchSnapshot();
});
test('renders the ThumbnailList component correctly', () => {
const component = createTestInstance(
);
expect(component.toJSON()).toMatchSnapshot();
});
test('Confirm Order button is disabled if submitting', () => {
const props = {
...defaultProps,
submitting: true
};
const component = createTestInstance();
expect(component.toJSON()).toMatchSnapshot();
});
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
});
});
test('renders the Carousel component correctly w/ sorted images', () => {
const component = createTestInstance(
);
expect(component.toJSON()).toMatchSnapshot();
});
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');
});
test('renders the correct tree', () => {
const instance = createTestInstance(
);
expect(instance.toJSON()).toMatchSnapshot();
});
test('clicking calls click handler with item index', () => {
const component = createTestInstance(
);
component.root.findByType('button').props.onClick();
expect(onClickHandler).toHaveBeenCalledWith(itemIndex);
onClickHandler.mockClear();
});
test('renders an null Editable Form component', () => {
const component = createTestInstance();
expect(component.toJSON()).toMatchSnapshot();
});
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();
});