Skip to content

Commit

Permalink
Modified testimonial (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
shema-surge authored Sep 4, 2024
1 parent 64af47e commit c2ae867
Show file tree
Hide file tree
Showing 19 changed files with 1,820 additions and 488 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "webpack server",
"build": "webpack",
"test": "npm run update-snapshots && npx jest ",
"test": "npm run update-snapshots && npx jest --runInBand",
"update-snapshots": "jest --updateSnapshot",
"coverage": "jest --collect-coverage --silent -u",
"lint": "npx eslint src/**/*.{tsx,ts} --fix",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Array [
>
<form
className="px-8 py-3 "
onSubmit={[Function]}
>
<div
className="flex flex-wrap items-center justify-center w-full card-title "
Expand All @@ -48,6 +49,7 @@ Array [
className="w-full px-5 py-2 font-sans text-xs text-black border rounded outline-none dark:bg-dark-tertiary border-primary"
name="email"
onChange={[Function]}
onSubmit={[Function]}
placeholder="email"
type="email"
value=""
Expand Down Expand Up @@ -461,7 +463,7 @@ Array [
name="date"
readOnly={true}
type="text"
value="2024-03-26"
value="2024-09-03"
/>
</div>
<div
Expand Down Expand Up @@ -890,7 +892,6 @@ Array [
onClick={[Function]}
type="button"
>
add
+
Expand Down
24 changes: 12 additions & 12 deletions src/components/tests/__snapshots__/Header.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ exports[`Header Tests Should render the header with home 1`] = `
>
<a
className=""
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -234,7 +234,7 @@ exports[`Header Tests Should render the header with home 1`] = `
className="p-2 w-full mt-2 dark:text-dark-text-fill text-primary"
>
<a
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -360,7 +360,7 @@ exports[`Header Tests Should render the header with no active 1`] = `
>
<a
className=""
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -503,7 +503,7 @@ exports[`Header Tests Should render the header with no active 1`] = `
className="p-2 w-full mt-2 dark:text-dark-text-fill text-primary"
>
<a
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -619,7 +619,7 @@ exports[`Header Tests Should render the header with no active 2`] = `
>
<a
className=""
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -749,7 +749,7 @@ exports[`Header Tests Should render the header with no active 2`] = `
className="p-2 w-full mt-2 dark:text-dark-text-fill text-primary"
>
<a
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -870,7 +870,7 @@ exports[`Header Tests Should render the header with no active 3`] = `
>
<a
className=""
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -1013,7 +1013,7 @@ exports[`Header Tests Should render the header with no active 3`] = `
className="p-2 w-full mt-2 dark:text-dark-text-fill text-primary"
>
<a
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -1140,7 +1140,7 @@ exports[`Header Tests Should render the header with pricing active 1`] = `
>
<a
className=""
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -1283,7 +1283,7 @@ exports[`Header Tests Should render the header with pricing active 1`] = `
className="p-2 w-full mt-2 dark:text-dark-text-fill text-primary"
>
<a
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -1409,7 +1409,7 @@ exports[`Header Tests Should render the header with product active 1`] = `
>
<a
className=""
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down Expand Up @@ -1552,7 +1552,7 @@ exports[`Header Tests Should render the header with product active 1`] = `
className="p-2 w-full mt-2 dark:text-dark-text-fill text-primary"
>
<a
href="/docs/org-signin"
href="/docs/getting-started"
onClick={[Function]}
>
Docs
Expand Down
6 changes: 5 additions & 1 deletion src/containers/admin-dashBoard/Sessions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ function AdminSission() {

{/* =========================== Start:: delete Session Model =============================== */}
<div
data-testid="delete-section"
className={`min-h-full w-screen z-30 bg-black bg-opacity-30 backdrop-blur-sm absolute flex items-center justify-center px-4 ${
deleteSessionModel === true ? 'block' : 'hidden'
}`}
Expand Down Expand Up @@ -372,7 +373,7 @@ function AdminSission() {

{/* =========================== Start:: update Session Model =============================== */}
{updateTraineeModel && sessionToEdit && (
<div className="min-h-full w-screen z-30 bg-black bg-opacity-30 backdrop-blur-sm absolute flex items-center justify-center px-4">
<div data-testid="update-section" className="min-h-full w-screen z-30 bg-black bg-opacity-30 backdrop-blur-sm absolute flex items-center justify-center px-4">
<div className="bg-white dark:bg-dark-bg w-full sm:w-3/4 md:w-1/2 xl:w-4/12 rounded-lg p-4 pb-8">
<div className="card-title w-full flex flex-wrap justify-center items-center">
<h3 className="font-bold text-sm text-gray-700 dark:text-white text-center w-11/12">
Expand All @@ -385,6 +386,7 @@ function AdminSission() {
<div className="input my-3 h-9">
<div className="grouped-input flex items-center h-full w-full rounded-md">
<input
data-testid="session-name"
type="text"
name="Sessionname"
placeholder={sessionToEdit.Sessionname}
Expand All @@ -396,6 +398,7 @@ function AdminSission() {
<div className="input my-3 h-9">
<div className="grouped-input flex items-center h-full w-full rounded-md">
<input
data-testid="description"
type="text"
name="description"
placeholder={sessionToEdit.description}
Expand Down Expand Up @@ -447,6 +450,7 @@ function AdminSission() {
{t('Cancel')}
</Button>
<Button
data-testid="save"
variant="primary"
size="sm"
style="w-[30%] md:w-1/4 text-sm font-sans"
Expand Down
51 changes: 28 additions & 23 deletions src/containers/admin-dashBoard/tests/Sessions.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import '@testing-library/jest-dom';
import { MockedProvider } from '@apollo/client/testing';
import { act } from 'react-dom/test-utils';
import AdminSission from '../Sessions';
Expand Down Expand Up @@ -53,8 +53,8 @@ describe('AdminSission Component', () => {
);

await waitFor(() => {
// expect(screen.getByText('Test Session 1')).toBeInTheDocument();
// expect(screen.getByText('Test Session 2')).toBeInTheDocument();
expect(screen.getByText('Test Session 1')).toBeInTheDocument();
expect(screen.getByText('Test Session 2')).toBeInTheDocument();
});
});

Expand All @@ -67,7 +67,7 @@ describe('AdminSission Component', () => {

await waitFor(() => {
fireEvent.click(screen.getByText('register +'));
// expect(screen.getByText('AddSession')).toBeInTheDocument();
expect(screen.getByText('AddSession')).toBeInTheDocument();
});
});

Expand Down Expand Up @@ -95,13 +95,16 @@ describe('AdminSission Component', () => {
</MockedProvider>,
);

// await waitFor(() => {
// fireEvent.click(screen.getByTestId('deleteIcon'));
// // expect(screen.getByText('reallydeleteSession')).toBeInTheDocument();
await waitFor(async () => {
fireEvent.click(screen.getAllByTestId('deleteIcon')[0]);
expect(screen.getByTestId('delete-section')).toBeInTheDocument();
expect(screen.getByTestId('delete-section')).toHaveClass("block");

// fireEvent.click(screen.getByText('Delete'));
// expect(screen.queryByText('reallydeleteSession')).toBeNull();
// });
fireEvent.click(screen.getByTestId('delete'));
await waitFor(()=>{
expect(screen.queryByTestId('delete-section')).toHaveClass("hidden");
})
});
});

it('updates a session when the edit icon is clicked and saved', async () => {
Expand Down Expand Up @@ -135,20 +138,22 @@ describe('AdminSission Component', () => {
</MockedProvider>,
);

// await waitFor(() => {
// fireEvent.click(screen.getByTestId('updateIcon'));
// // expect(screen.getByText('UpdateSession')).toBeInTheDocument();
await waitFor(async() => {
fireEvent.click(screen.getAllByTestId('updateIcon')[0]);
expect(screen.getByTestId('update-section')).toBeInTheDocument();

// // Simulate updating session details
// fireEvent.change(screen.getByLabelText('Sessionname'), {
// target: { value: 'Updated Session Name' },
// });
// fireEvent.change(screen.getByLabelText('description'), {
// target: { value: 'Updated Description' },
// });
// Simulate updating session details
fireEvent.change(screen.getByTestId('session-name'), {
target: { value: 'Updated Session Name' },
});
fireEvent.change(screen.getByTestId('description'), {
target: { value: 'Updated Description' },
});

// fireEvent.click(screen.getByText('Save'));
// expect(screen.queryByText('UpdateSession')).toBeNull();
// });
fireEvent.click(screen.getByTestId('save'));
await waitFor(()=>{
expect(screen.queryByText('update-section')).toBeNull();
})
});
});
});
Loading

0 comments on commit c2ae867

Please sign in to comment.