mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 20:01:59 +00:00
Update test case for sortBy, select, orderBy component
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
// Components
|
||||
import RoomForm from '../RoomForm';
|
||||
|
||||
describe('RoomForm', () => {
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
const wrapper = renderer.create(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<BrowserRouter>
|
||||
<RoomForm />
|
||||
</BrowserRouter>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
|
||||
test('Should render correctly', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
@@ -1,28 +0,0 @@
|
||||
import renderer from 'react-test-renderer';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
|
||||
// Types
|
||||
import { IRoom } from '@type/rooms';
|
||||
|
||||
// Components
|
||||
import RoomRow from '../RoomRow';
|
||||
|
||||
describe('RoomRow', () => {
|
||||
const tempRoom: IRoom = {
|
||||
id: 1,
|
||||
name: 'Temp Room',
|
||||
price: 250,
|
||||
status: true,
|
||||
};
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
const wrapper = renderer.create(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<RoomRow room={tempRoom} key={tempRoom.id} />
|
||||
</QueryClientProvider>
|
||||
);
|
||||
|
||||
test('Should render correctly', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
import renderer from 'react-test-renderer';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
|
||||
// Components
|
||||
import RoomTable from '../RoomTable';
|
||||
|
||||
describe('RoomTable', () => {
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
const wrapper = renderer.create(
|
||||
<BrowserRouter>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<RoomTable />
|
||||
</QueryClientProvider>
|
||||
</BrowserRouter>
|
||||
);
|
||||
|
||||
test('Should render correctly', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
@@ -1,67 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`RoomForm Should render correctly 1`] = `
|
||||
<form
|
||||
className="sc-dlniIP bCPNqw"
|
||||
onSubmit={[Function]}
|
||||
>
|
||||
<div
|
||||
className="sc-eCAqax eozPUK"
|
||||
>
|
||||
<label
|
||||
className="sc-jSFipO cMYxin"
|
||||
>
|
||||
Name
|
||||
</label>
|
||||
<div>
|
||||
<input
|
||||
className="sc-gtsqUy fGZPSU"
|
||||
id="name"
|
||||
name="name"
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="sc-eCAqax eozPUK"
|
||||
>
|
||||
<label
|
||||
className="sc-jSFipO cMYxin"
|
||||
>
|
||||
Price
|
||||
</label>
|
||||
<div>
|
||||
<input
|
||||
className="sc-gtsqUy fGZPSU"
|
||||
id="price"
|
||||
name="price"
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="sc-hKFymg dteuGK"
|
||||
>
|
||||
<button
|
||||
className="sc-bdnyFh sc-iCoHzw hHmoPp jAHgeA"
|
||||
disabled={false}
|
||||
name="submit"
|
||||
type="submit"
|
||||
variations="primary"
|
||||
>
|
||||
Add
|
||||
</button>
|
||||
<button
|
||||
className="sc-bdnyFh sc-iCoHzw bjdOKm jAHgeA"
|
||||
type="button"
|
||||
variations="secondary"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
`;
|
||||
@@ -1,53 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`RoomRow Should render correctly 1`] = `
|
||||
<div
|
||||
className="sc-crzpnZ sc-bqGGcD gIMFtm jqrNRF"
|
||||
>
|
||||
<div>
|
||||
1
|
||||
</div>
|
||||
<div>
|
||||
Temp Room
|
||||
</div>
|
||||
<div>
|
||||
$250.00
|
||||
</div>
|
||||
<div>
|
||||
Unavailable
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
className="sc-fnVZQs CCxtf"
|
||||
>
|
||||
<button
|
||||
aria-label="Menu item 1"
|
||||
className="sc-bkbjWr fCztjK"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
stroke="currentColor"
|
||||
strokeWidth="0"
|
||||
style={
|
||||
{
|
||||
"color": undefined,
|
||||
}
|
||||
}
|
||||
viewBox="0 0 24 24"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
clipRule="evenodd"
|
||||
d="M10.5 6a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zm0 6a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zm0 6a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0z"
|
||||
fillRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -1,63 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`RoomTable Should render correctly 1`] = `
|
||||
<div
|
||||
className="sc-iJCSeZ crZyCc"
|
||||
type="vertical"
|
||||
>
|
||||
<div
|
||||
className="sc-lmgPJu cuMSiO"
|
||||
>
|
||||
<div
|
||||
className="sc-crzpnZ iahNiP"
|
||||
>
|
||||
<button
|
||||
active={true}
|
||||
className="sc-dItHI guVVWw"
|
||||
disabled={true}
|
||||
onClick={[Function]}
|
||||
>
|
||||
Ascending
|
||||
</button>
|
||||
<button
|
||||
active={false}
|
||||
className="sc-dItHI fIRqtD"
|
||||
disabled={false}
|
||||
onClick={[Function]}
|
||||
>
|
||||
Descending
|
||||
</button>
|
||||
</div>
|
||||
<select
|
||||
aria-label="Sort"
|
||||
className="sc-iqAbyq czAJZn"
|
||||
onChange={[Function]}
|
||||
value=""
|
||||
>
|
||||
<option
|
||||
value="id"
|
||||
>
|
||||
Sort by id
|
||||
</option>
|
||||
<option
|
||||
value="name"
|
||||
>
|
||||
Sort by name
|
||||
</option>
|
||||
<option
|
||||
value="price"
|
||||
>
|
||||
Sort by price
|
||||
</option>
|
||||
</select>
|
||||
<input
|
||||
className="sc-kEqXeH jMVPeG"
|
||||
onChange={[Function]}
|
||||
placeholder="Search by name..."
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="sc-giAruI hMNXks"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -1,84 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Room Should render correctly 1`] = `
|
||||
<main
|
||||
className="sc-iwaiBT gPCYSC"
|
||||
>
|
||||
<div
|
||||
className="sc-iJCSeZ jDHUlN"
|
||||
type="horizontal"
|
||||
>
|
||||
<h2
|
||||
className="sc-cxNGUP ffcGOQ"
|
||||
>
|
||||
List Room
|
||||
</h2>
|
||||
<button
|
||||
className="sc-bqGGcD cVmQmy"
|
||||
onClick={[Function]}
|
||||
variations="primary"
|
||||
>
|
||||
Add room
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
className="sc-iJCSeZ crZyCc"
|
||||
type="vertical"
|
||||
>
|
||||
<div
|
||||
className="sc-lmgPJu cuMSiO"
|
||||
>
|
||||
<div
|
||||
className="sc-crzpnZ iahNiP"
|
||||
>
|
||||
<button
|
||||
active={true}
|
||||
className="sc-dItHI guVVWw"
|
||||
disabled={true}
|
||||
onClick={[Function]}
|
||||
>
|
||||
Ascending
|
||||
</button>
|
||||
<button
|
||||
active={false}
|
||||
className="sc-dItHI fIRqtD"
|
||||
disabled={false}
|
||||
onClick={[Function]}
|
||||
>
|
||||
Descending
|
||||
</button>
|
||||
</div>
|
||||
<select
|
||||
aria-label="Sort"
|
||||
className="sc-iqAbyq czAJZn"
|
||||
onChange={[Function]}
|
||||
value=""
|
||||
>
|
||||
<option
|
||||
value="id"
|
||||
>
|
||||
Sort by id
|
||||
</option>
|
||||
<option
|
||||
value="name"
|
||||
>
|
||||
Sort by name
|
||||
</option>
|
||||
<option
|
||||
value="price"
|
||||
>
|
||||
Sort by price
|
||||
</option>
|
||||
</select>
|
||||
<input
|
||||
className="sc-kEqXeH jMVPeG"
|
||||
onChange={[Function]}
|
||||
placeholder="Search by name..."
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="sc-giAruI hMNXks"
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
`;
|
||||
@@ -1,22 +0,0 @@
|
||||
import Room from '..';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
|
||||
// Components
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
describe('Room', () => {
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
const wrapper = renderer.create(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<BrowserRouter>
|
||||
<Room />
|
||||
</BrowserRouter>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
|
||||
test('Should render correctly', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
@@ -35,16 +35,19 @@ exports[`UserTable Should render correctly 1`] = `
|
||||
value=""
|
||||
>
|
||||
<option
|
||||
data-testid="select-option"
|
||||
value="id"
|
||||
>
|
||||
Sort by id
|
||||
</option>
|
||||
<option
|
||||
data-testid="select-option"
|
||||
value="name"
|
||||
>
|
||||
Sort by name
|
||||
</option>
|
||||
<option
|
||||
data-testid="select-option"
|
||||
value="price"
|
||||
>
|
||||
Sort by price
|
||||
|
||||
@@ -55,16 +55,19 @@ exports[`User Should render correctly 1`] = `
|
||||
value=""
|
||||
>
|
||||
<option
|
||||
data-testid="select-option"
|
||||
value="id"
|
||||
>
|
||||
Sort by id
|
||||
</option>
|
||||
<option
|
||||
data-testid="select-option"
|
||||
value="name"
|
||||
>
|
||||
Sort by name
|
||||
</option>
|
||||
<option
|
||||
data-testid="select-option"
|
||||
value="phone"
|
||||
>
|
||||
Sort by phone
|
||||
|
||||
Reference in New Issue
Block a user