Skip to content

Commit

Permalink
refactor: removido throw error nos testes
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavogularte committed Sep 25, 2024
1 parent 0236e09 commit 772272d
Showing 1 changed file with 15 additions and 28 deletions.
43 changes: 15 additions & 28 deletions src/components/Tabber/PostModes/PostModes.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ describe('PostModes', () => {
/>
);
const socialMedia = mockedSocialMedias().get(mockAccount.socialMediaId);
if (!socialMedia?.postModes) {
throw new Error(
`Social media or post modes not found for ID ${mockAccount.socialMediaId}`
);
}
const { postModes } = socialMedia;
const firstPostModeName = postModes[0].name;

const postModes = socialMedia?.postModes;
const firstPostModeName = postModes ? postModes[0].name : '';

const postMode = screen.getByText(firstPostModeName);

Expand All @@ -69,13 +65,10 @@ describe('PostModes', () => {
const user = userEvent.setup();

const socialMedia = mockedSocialMedias().get(mockAccount.socialMediaId);
if (!socialMedia?.postModes) {
throw new Error(
`Social media or post modes not found for ID ${mockAccount.socialMediaId}`
);
}
const { postModes } = socialMedia;
const firstPostModeName = postModes[0].name;

const postModes = socialMedia?.postModes;
const firstPostModeName = postModes ? postModes[0].name : '';

const postMode = screen.getByText(firstPostModeName);

await user.click(postMode);
Expand All @@ -95,13 +88,10 @@ describe('PostModes', () => {
const user = userEvent.setup();

const socialMedia = mockedSocialMedias().get(mockAccount.socialMediaId);
if (!socialMedia?.postModes) {
throw new Error(
`Social media or post modes not found for ID ${mockAccount.socialMediaId}`
);
}
const { postModes } = socialMedia;
const firstPostModeName = postModes[0].name;

const postModes = socialMedia?.postModes;
const firstPostModeName = postModes ? postModes[0].name : '';

const postModeCheckbox = screen.getByLabelText(
`Check the post mode ${firstPostModeName}`
);
Expand All @@ -122,13 +112,10 @@ describe('PostModes', () => {
const user = userEvent.setup();

const socialMedia = mockedSocialMedias().get(mockAccount.socialMediaId);
if (!socialMedia?.postModes) {
throw new Error(
`Social media or post modes not found for ID ${mockAccount.socialMediaId}`
);
}
const { postModes } = socialMedia;
const firstPostModeName = postModes[0].name;

const postModes = socialMedia?.postModes;
const firstPostModeName = postModes ? postModes[0].name : '';

const postModeCheckbox = screen.getByLabelText(
`Check the post mode ${firstPostModeName}`
);
Expand Down

0 comments on commit 772272d

Please sign in to comment.