Skip to content

Commit

Permalink
update and delete button are know working
Browse files Browse the repository at this point in the history
  • Loading branch information
kanhaiya04 committed Nov 7, 2023
1 parent 0980326 commit 2cf0e4f
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 224 deletions.
4 changes: 1 addition & 3 deletions src/components/EventListCard/EventListCard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
justify-content: flex-end;
}
.icon {
transform: scale(1);
cursor: pointer;
color: #31bb6b;
margin: 1px;
}

.cards {
Expand Down
41 changes: 37 additions & 4 deletions src/components/EventListCard/EventListCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,30 @@ describe('Testing Event List Card', () => {
expect(screen.queryByText(props.eventName)).not.toBeInTheDocument();
});

test('Testing for update modal', async () => {
render(
<MockedProvider addTypename={false} link={link}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<EventListCard {...props} />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>
);

await wait();

userEvent.click(screen.getByTestId('card'));
userEvent.click(screen.getByTestId('editEventModalBtn'));

userEvent.click(screen.getByTestId('EventUpdateModalCloseBtn'));
userEvent.click(screen.getByTestId('createEventModalCloseBtn'));

await wait();
});

test('Testing event update functionality', async () => {
render(
<MockedProvider addTypename={false} link={link}>
Expand All @@ -159,7 +183,8 @@ describe('Testing Event List Card', () => {
);

await wait();

userEvent.click(screen.getByTestId('card'));
userEvent.click(screen.getByTestId('editEventModalBtn'));
userEvent.type(screen.getByTestId('updateTitle'), props.eventName);
userEvent.type(
screen.getByTestId('updateDescription'),
Expand Down Expand Up @@ -199,7 +224,8 @@ describe('Testing Event List Card', () => {
);

await wait();

userEvent.click(screen.getByTestId('card'));
userEvent.click(screen.getByTestId('editEventModalBtn'));
userEvent.type(screen.getByTestId('updateTitle'), props.eventName);
userEvent.type(
screen.getByTestId('updateDescription'),
Expand Down Expand Up @@ -232,6 +258,11 @@ describe('Testing Event List Card', () => {
<EventListCard {...props} />
</MockedProvider>
);
userEvent.click(screen.getByTestId('card'));
userEvent.click(screen.getByTestId('deleteEventModalBtn'));

userEvent.click(screen.getByTestId('EventDeleteModalCloseBtn'));
userEvent.click(screen.getByTestId('createEventModalCloseBtn'));
});

it('should call the delete event mutation when the "Yes" button is clicked', async () => {
Expand All @@ -240,7 +271,8 @@ describe('Testing Event List Card', () => {
<EventListCard {...props} />
</MockedProvider>
);

userEvent.click(screen.getByTestId('card'));
userEvent.click(screen.getByTestId('deleteEventModalBtn'));
const deleteBtn = screen.getByTestId('deleteEventBtn');
fireEvent.click(deleteBtn);
});
Expand All @@ -263,7 +295,8 @@ describe('Testing Event List Card', () => {
<EventListCard {...props} />
</MockedProvider>
);

userEvent.click(screen.getByTestId('card'));
userEvent.click(screen.getByTestId('deleteEventModalBtn'));
const deleteBtn = screen.getByTestId('deleteEventBtn');
fireEvent.click(deleteBtn);
});
Expand Down
Loading

0 comments on commit 2cf0e4f

Please sign in to comment.