@financial-times/n-conversion-forms
Version:
Containing jsx components and styles for forms included on Accounts and Acquisition apps (next-signup, next-profile, next-retention, etc).
67 lines (45 loc) • 1.75 kB
JavaScript
import { DeliveryStartDate } from './index';
import { expectToRenderCorrectly } from '../test-jest/helpers/expect-to-render-correctly';
expect.extend(expectToRenderCorrectly);
describe('DeliveryStartDate', () => {
it('renders with default props', () => {
const props = {};
expect(DeliveryStartDate).toRenderCorrectly(props);
});
it('renders with an error', () => {
const props = { hasError: true };
expect(DeliveryStartDate).toRenderCorrectly(props);
});
it('renders with a custom date', () => {
const props = { date: '5th November 2019' };
expect(DeliveryStartDate).toRenderCorrectly(props);
});
it('renders with a custom input value', () => {
const props = { value: 'Foobar' };
expect(DeliveryStartDate).toRenderCorrectly(props);
});
it('renders with a custom input min value', () => {
const props = { min: '1' };
expect(DeliveryStartDate).toRenderCorrectly(props);
});
it('renders with a custom input max value', () => {
const props = { date: '2' };
expect(DeliveryStartDate).toRenderCorrectly(props);
});
it('renders with a disabled input', () => {
const props = { isDisabled: true };
expect(DeliveryStartDate).toRenderCorrectly(props);
});
it('renders with appropriate start message when isAddressUpdate', () => {
const props = { isAddressUpdate: true };
expect(DeliveryStartDate).toRenderCorrectly(props);
});
it('renders with appropriate start message when isPaperVoucherDeliveryOptionOnly', () => {
const props = { isPaperVoucherDeliveryOptionOnly: true };
expect(DeliveryStartDate).toRenderCorrectly(props);
});
it('renders with country different than default', () => {
const props = { country: 'USA' };
expect(DeliveryStartDate).toRenderCorrectly(props);
});
});