Skip to content

Commit

Permalink
added test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
akanshaaa19 committed Sep 8, 2024
1 parent 8a665c4 commit 0d14728
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/containers/Profile/Contact/ContactProfile.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ describe('contact profile with single profile', () => {
await waitFor(() => {
expect(getAllByRole('textbox')[0]).toHaveValue('N/A');
});

fireEvent.click(getByText('History'));

await waitFor(() => {
expect(screen.getByText('Removed from collection: "Optout contacts"')).toBeInTheDocument();
});

fireEvent.click(getByText('Details'));

await waitFor(() => {

Check failure on line 46 in src/containers/Profile/Contact/ContactProfile.test.tsx

View workflow job for this annotation

GitHub Actions / CI

src/containers/Profile/Contact/ContactProfile.test.tsx > contact profile with single profile > contact profile should render

TestingLibraryElementError: Unable to find an element with the text: Optin via BSP on 19/08/2021, 14:58:01. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible. Ignored nodes: comments, script, style <body> <div> <div class="_Heading_7e7077" data-testid="heading" > <div class="_HeadingWrapper_7e7077" > <div class="_BackIcon_7e7077" > <svg data-testid="back-button" fill="none" height="40" viewBox="0 0 40 40" width="40" xmlns="http://www.w3.org/2000/svg" > <circle cx="20" cy="20" fill="white" r="19.5" stroke="#CCCCCC" /> <path d="M22.9292 28L15 20L22.9292 12L24.3333 13.4167L17.8083 20L24.3333 26.5833L22.9292 28Z" fill="#717971" /> </svg> </div> <div> <div class="_HeadingTitle_7e7077" > <div class="_TitleText_7e7077" > Contact Profile </div> </div> <div class="_TextHeading_7e7077" /> </div> </div> </div> <div class="_ContactProfile_9031bc MuiBox-root css-0" > <div class="_Drawer_9031bc" > <div class="_ProfileHeader_9031bc" data-testid="profileHeader" > <div class="_ProfileHeaderTitle_9031bc _SelectedProfile_9031bc" > <div class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault _Default_499029 css-17o22dy-MuiAvatar-root" > D </div> Default User </div> <svg fill="none" height="20" viewBox="0 0 19 20" width="19" xmlns="http://www.w3.org/2000/svg" > <path d="M9.49998 13.1442L13.6442 8.99998L12.575 7.95578L9.49998 11.0308L6.42498 7.95578L5.35578 8.99998L9.49998 13.1442ZM9.50165 19.5C8.18772 19.5 6.95268 19.2506 5.79655 18.752C4.6404 18.2533 3.63472 17.5765 2.7795 16.7217C1.92427 15.8669 1.24721 14.8616 0.748325 13.706C0.249442 12.5504 0 11.3156 0 10.0017C0 8.68772 0.249334 7.45268 0.748 6.29655C1.24667 5.1404 1.92342 4.13472 2.77825 3.2795C3.6331 2.42427 4.63834 1.74721 5.79398 1.24833C6.94959 0.749443 8.18437 0.5 9.4983 0.5C10.8122 0.5 12.0473 0.749334 13.2034 1.248C14.3596 1.74667 15.3652 2.42342 16.2205 3.27825C17.0757 4.1331 17.7527 5.13834 18.2516 6.29398C18.7505 7.44959 19 8.68437 19 9.9983C19 11.3122 18.7506 12.5473 18.252 13.7034C17.7533 14.8596 17.0765 15.8652 16.2217 16.7205C15.3669 17.5757 14.3616 18.2527 13.206 18.7516C12.0504 19.2505 10.8156 19.5 9.50165 19.5ZM9.49998 18C11.7333 18 13.625 17.225 15.175 15.675C16.725 14.125 17.5 12.2333 17.5 9.99998C17.5 7.76664 16.725 5.87498 15.175 4.32498C13.625 2.77498 11.7333 1.99998 9.49998 1.99998C7.26664 1.99998 5.37498 2.77498 3.82498 4.32498C2.27498 5.87498 1.49998 7.76664 1.49998 9.99998C1.49998 12.2333 2.27498 14.125 3.82498 15.675C5.37498 17.225 7.26664 18 9.49998 18Z" fill="#073F24" /> </svg> </div> <div class="MuiCollapse-root MuiCollapse-vertical MuiCollapse-entered css-wz2cs5-MuiCollapse-root" style="min-height: 0px;" > <div class="MuiCollapse-wrapper MuiCollapse-vertical css-smkl36-MuiCollapse-wrapper" > <div class="MuiCollapse-wrapperInner MuiCollapse-vertical css-9l5vo-MuiCollapse-wrapperInner" > <div class="_ProfileHeaderElements_9031bc" > <div class="_Tab_9031bc " > Profile </div> <d
expect(screen.getByText('Optin via BSP on 19/08/2021, 14:58:01')).toBeInTheDocument();
});
});
});

Expand Down
4 changes: 0 additions & 4 deletions src/containers/Profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ export const Profile = ({
}
const { selectedProfile, selectedProfileId } = multiProfileAttributes;

if (!selectedProfile) {
return;
}

if (selectedProfileId === multiProfileAttributes.activeProfileId) {
setName(`${selectedProfile.name} (currently active)`);
} else {
Expand Down

0 comments on commit 0d14728

Please sign in to comment.