Skip to content

Commit

Permalink
fix: code cleanup and renaming components (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasbuenoencora authored and DerekRoberts committed May 14, 2024
1 parent 04bb875 commit 7bb4ee9
Show file tree
Hide file tree
Showing 39 changed files with 172 additions and 1,105 deletions.
24 changes: 2 additions & 22 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import {

import './custom.scss';

import Form from './views/Form';
import Table from './views/Table';
import ProtectedRoute from './routes/ProtectedRoute';
import { useAuth } from './contexts/AuthContext';
import SilentCheckSso from './components/SilentCheckSso';
import Logout from './components/Logout';
import Layout from './layout/PrivateLayout';
import NewLanding from './views/NewLanding';
import Landing from './views/Landing';
import Dashboard from './views/Dashboard/dashboard';
import SeedlotDashboard from './views/SeedlotDashboard';

Expand All @@ -28,7 +26,7 @@ const App: React.FC = () => {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<NewLanding />} />
<Route path="/" element={<Landing />} />
<Route path="/" element={<Layout />}>
<Route path="/silent-check-sso" element={<SilentCheckSso />} />
<Route path="/logout" element={<Logout />} />
Expand All @@ -50,24 +48,6 @@ const App: React.FC = () => {
</ProtectedRoute>
)}
/>

<Route
path="/form"
element={(
<ProtectedRoute signed={signed}>
<Form />
</ProtectedRoute>
)}
/>

<Route
path="/table"
element={(
<ProtectedRoute signed={signed}>
<Table />
</ProtectedRoute>
)}
/>
</Route>
</Routes>
</BrowserRouter>
Expand Down
2 changes: 1 addition & 1 deletion src/__test__/components/FavouriteActivities.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import makeServer from '../../mock-api/server';
jest.setTimeout(10000);

// empty section should be tested in the future
describe('the Favorite Activities component', () => {
describe('the Favourite Activities component', () => {
beforeAll(() => {
makeServer('test');
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-disable no-undef */
import React from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
import FavoriteCard from '../../components/Card/FavoriteCard';
import FavouriteCard from '../../components/Card/FavouriteCard';
import '@testing-library/jest-dom/extend-expect';

describe('the favorite card component', () => {
describe('the favourite card component', () => {
it('should render correctly with headers', async () => {
const { container } = render(
<FavoriteCard
<FavouriteCard
header="Test"
description="For testing"
icon="SoilMoistureField"
Expand All @@ -24,7 +24,7 @@ describe('the favorite card component', () => {

it('should render card highlighted with different style', () => {
const { container } = render(
<FavoriteCard
<FavouriteCard
header="Test"
description="For testing"
icon="SoilMoistureField"
Expand All @@ -38,7 +38,7 @@ describe('the favorite card component', () => {

it('should click in the button and open the options', () => {
const { container } = render(
<FavoriteCard
<FavouriteCard
header="Test"
description="For testing"
icon="SoilMoistureField"
Expand All @@ -53,7 +53,7 @@ describe('the favorite card component', () => {

it('should close the dropdown menu when click outside', () => {
const { container } = render(
<FavoriteCard
<FavouriteCard
header="Test"
description="For testing"
icon="SoilMoistureField"
Expand Down
38 changes: 0 additions & 38 deletions src/__test__/components/LoadingButton.test.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/__test__/components/PageTitle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ describe('the page title component', () => {
expect(screen.getByText('Test Subtitle')).toBeInTheDocument();
});

it('should render correctly with favorite option', () => {
it('should render correctly with favourite option', () => {
render(
<PageTitle title="Test title" subtitle="Test Subtitle" favorite />
<PageTitle title="Test title" subtitle="Test Subtitle" favourite />
);

expect(screen.getAllByRole('button')[0]).toBeInTheDocument();
Expand Down
41 changes: 0 additions & 41 deletions src/__test__/components/UserTable.test.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/__test__/components/__snapshots__/LoadingButton.test.tsx.snap

This file was deleted.

87 changes: 0 additions & 87 deletions src/__test__/components/__snapshots__/UserTable.test.tsx.snap

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { render } from '@testing-library/react';
import renderer from 'react-test-renderer';
import NewLanding from '../../views/NewLanding';
import Landing from '../../views/Landing';
import { AuthProvider } from '../../contexts/AuthContext';

describe('NewLanding component test', () => {
describe('Landing component test', () => {
it('should have the correct title', () => {
const { getByTestId } = render(
<BrowserRouter>
<AuthProvider>
<NewLanding />
<Landing />
</AuthProvider>
</BrowserRouter>
);
Expand All @@ -33,15 +33,15 @@ describe('NewLanding component test', () => {
});

it('should match the snapshot', () => {
const newLanding = renderer
const landing = renderer
.create(
<BrowserRouter>
<AuthProvider>
<NewLanding />
<Landing />
</AuthProvider>
</BrowserRouter>
).toJSON();

expect(newLanding).toMatchSnapshot();
expect(landing).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`NewLanding component test should match the snapshot 1`] = `
exports[`Landing component test should match the snapshot 1`] = `
<div
className="landing-grid cds--css-grid cds--css-grid--full-width"
>
Expand Down
Loading

0 comments on commit 7bb4ee9

Please sign in to comment.