Skip to content

Commit

Permalink
fixup! ✨(website) creates lives on the website
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoLC committed Mar 22, 2023
1 parent 5ba1bbe commit 483c2ae
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ import LiveCreate from './LiveCreate';

jest.mock('./LiveCreateForm', () => ({
__esModule: true,
default: () => <div>My LiveCreate Form</div>,
default: () => <div>My WebinarCreate Form</div>,
}));

describe('<LiveCreate />', () => {
test('renders LiveCreate', () => {
render(<LiveCreate />);

const button = screen.getByRole('button', { name: /Create Live/i });
const button = screen.getByRole('button', { name: /Create Webinar/i });
expect(button).toBeInTheDocument();
expect(
screen.queryByRole('heading', { name: /Create Live/i }),
screen.queryByRole('heading', { name: /Create Webinar/i }),
).not.toBeInTheDocument();

userEvent.click(button);

expect(
screen.getByRole('heading', { name: /Create Live/i }),
screen.getByRole('heading', { name: /Create Webinar/i }),
).toBeInTheDocument();
expect(screen.getByText('My LiveCreate Form')).toBeInTheDocument();
expect(screen.getByText('My WebinarCreate Form')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import { routes } from 'routes';
import LiveCreateForm from './LiveCreateForm';

const messages = defineMessages({
LiveTitle: {
defaultMessage: 'Lives',
description: 'Lives title',
id: 'features.Contents.features.Live.Create.LiveTitle',
WebinarTitle: {
defaultMessage: 'Webinars',
description: 'Webinars title',
id: 'features.Contents.features.Webinar.Create.WebinarTitle',
},
CreateLiveLabel: {
defaultMessage: 'Create Live',
description: 'Text heading create live.',
id: 'features.Contents.features.Live.Create.CreateLiveLabel',
CreateWebinarLabel: {
defaultMessage: 'Create Webinar',
description: 'Text heading create webinar.',
id: 'features.Contents.features.Webinar.Create.CreateWebinarLabel',
},
});

Expand All @@ -44,12 +44,12 @@ const LiveCreate = () => {
margin={{ bottom: 'medium' }}
>
<Text size="large" weight="bold">
{intl.formatMessage(messages.LiveTitle)}
{intl.formatMessage(messages.WebinarTitle)}
</Text>
<Link to={liveCreatePath}>
<Button
primary
label={intl.formatMessage(messages.CreateLiveLabel)}
label={intl.formatMessage(messages.CreateWebinarLabel)}
/>
</Link>
</WhiteCard>
Expand All @@ -67,7 +67,7 @@ const LiveCreate = () => {
textAlign="center"
weight="bold"
>
{intl.formatMessage(messages.CreateLiveLabel)}
{intl.formatMessage(messages.CreateWebinarLabel)}
</Heading>
<LiveCreateForm />
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('<LiveCreateForm />', () => {
screen.getByRole('textbox', { name: /description/i }),
).toBeInTheDocument();
expect(
screen.getByRole('button', { name: /Add Live/i }),
screen.getByRole('button', { name: /Add Webinar/i }),
).toBeInTheDocument();
});

Expand Down Expand Up @@ -83,7 +83,7 @@ describe('<LiveCreateForm />', () => {

await waitFor(() =>
expect(
screen.getByRole('button', { name: /Add Live/i }),
screen.getByRole('button', { name: /Add Webinar/i }),
).not.toBeDisabled(),
);
});
Expand Down Expand Up @@ -139,7 +139,7 @@ describe('<LiveCreateForm />', () => {
}),
).toBeInTheDocument();

const submit = screen.getByRole('button', { name: /Add Live/i });
const submit = screen.getByRole('button', { name: /Add Webinar/i });

await waitFor(() => expect(submit).not.toBeDisabled());

Expand Down Expand Up @@ -198,7 +198,7 @@ describe('<LiveCreateForm />', () => {
}),
).toBeInTheDocument();

const submit = screen.getByRole('button', { name: /Add Live/i });
const submit = screen.getByRole('button', { name: /Add Webinar/i });

await waitFor(() => expect(submit).not.toBeDisabled());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ import { routes } from 'routes';
const messages = defineMessages({
titleLabel: {
defaultMessage: 'Title',
description: 'Label for title in live creation form.',
description: 'Label for title in webinar creation form.',
id: 'features.Contents.features.Live.LiveCreateForm.titleLabel',
},
descriptionLabel: {
defaultMessage: 'Description',
description: 'Label for description in live creation form.',
description: 'Label for description in webinar creation form.',
id: 'features.Contents.features.Live.LiveCreateForm.descriptionLabel',
},
requiredField: {
defaultMessage: 'This field is required to create the live.',
description: 'Message when live field is missing.',
defaultMessage: 'This field is required to create the webinar.',
description: 'Message when webinar field is missing.',
id: 'features.Contents.features.Live.LiveCreateForm.requiredField',
},
submitLabel: {
defaultMessage: 'Add Live',
description: 'Label for button submit in live creation form.',
defaultMessage: 'Add Webinar',
description: 'Label for button submit in webinar creation form.',
id: 'features.Contents.features.Live.LiveCreateForm.submitLabel',
},
Error: {
Expand Down

0 comments on commit 483c2ae

Please sign in to comment.