From a64b0b367193d3adb9d37dff73aeafaaee9541cc Mon Sep 17 00:00:00 2001 From: devinleighsmith Date: Mon, 29 Apr 2024 11:46:40 -0700 Subject: [PATCH] vitest fixes. --- .github/workflows/app-react.yml | 2 +- source/frontend/package.json | 2 +- .../contacts/list/ContactListView.test.tsx | 6 +- .../ContactListView.test.tsx.snap | 341 +++++++++++++++++- .../detail/PropertyDetailsTabView.test.tsx | 2 +- source/frontend/vite.config.ts | 3 +- 6 files changed, 345 insertions(+), 11 deletions(-) diff --git a/.github/workflows/app-react.yml b/.github/workflows/app-react.yml index 108185bb5d..f378e51f4c 100644 --- a/.github/workflows/app-react.yml +++ b/.github/workflows/app-react.yml @@ -52,7 +52,7 @@ jobs: - run: npm run build --if-present working-directory: ${{env.working-directory}} - - run: npm run coverage -- --maxWorkers=2 + - run: npm run coverage -- --bail 1 working-directory: ${{env.working-directory}} env: REACT_APP_TENANT: MOTI diff --git a/source/frontend/package.json b/source/frontend/package.json index 0d9b902940..e1265fdfa4 100644 --- a/source/frontend/package.json +++ b/source/frontend/package.json @@ -140,7 +140,7 @@ "test": "tsc && vitest run", "test-u": "tsc && vitest run -u", "test:watch": "vitest watch", - "coverage": "vitest run --coverage --reporter=vitest-sonar-reporter", + "coverage": "vitest run --coverage", "update-snapshots": "vitest run -u", "eject": "react-scripts eject", "lint": "eslint src/ --ext .jsx,.js,.ts,.tsx --max-warnings 0", diff --git a/source/frontend/src/features/contacts/list/ContactListView.test.tsx b/source/frontend/src/features/contacts/list/ContactListView.test.tsx index 6bfbc994b6..43d385f051 100644 --- a/source/frontend/src/features/contacts/list/ContactListView.test.tsx +++ b/source/frontend/src/features/contacts/list/ContactListView.test.tsx @@ -12,6 +12,7 @@ import { RenderOptions, waitFor, waitForElementToBeRemoved, + screen, } from '@/utils/test-utils'; import { ContactListPage } from './ContactListPage'; @@ -75,10 +76,9 @@ describe('Contact List View', () => { }); it('matches snapshot', async () => { - setupMockSearch(); - const { asFragment, getByText } = setup(); - await act(async () => {}); setupMockSearch([defaultPersonSearchResult]); + const { asFragment } = setup(); + await act(async () => {}); const fragment = await waitFor(() => asFragment()); expect(fragment).toMatchSnapshot(); diff --git a/source/frontend/src/features/contacts/list/__snapshots__/ContactListView.test.tsx.snap b/source/frontend/src/features/contacts/list/__snapshots__/ContactListView.test.tsx.snap index a04444b85f..30a7ad442f 100644 --- a/source/frontend/src/features/contacts/list/__snapshots__/ContactListView.test.tsx.snap +++ b/source/frontend/src/features/contacts/list/__snapshots__/ContactListView.test.tsx.snap @@ -141,6 +141,29 @@ exports[`Contact List View > matches snapshot 1`] = ` margin-right: 0; } +.c16.c16.btn { + background-color: unset; + border: none; +} + +.c16.c16.btn:hover, +.c16.c16.btn:focus, +.c16.c16.btn:active { + background-color: unset; + outline: none; + box-shadow: none; +} + +.c16.c16.btn svg { + -webkit-transition: all 0.3s ease-out; + transition: all 0.3s ease-out; +} + +.c16.c16.btn svg:hover { + -webkit-transition: all 0.3s ease-in; + transition: all 0.3s ease-in; +} + .c7 { display: -webkit-box; display: -webkit-flex; @@ -188,6 +211,10 @@ exports[`Contact List View > matches snapshot 1`] = ` height: 1.6rem; } +.c17 { + margin-top: 0.3rem; +} + .c6 { display: -webkit-box; display: -webkit-flex; @@ -274,6 +301,14 @@ exports[`Contact List View > matches snapshot 1`] = ` overflow-y: auto; } +.c15 { + -webkit-box-pack: space-around; + -webkit-justify-content: space-around; + -ms-flex-pack: space-around; + justify-content: space-around; + width: 100%; +} + .c0 { display: -webkit-box; display: -webkit-flex; @@ -957,9 +992,184 @@ exports[`Contact List View > matches snapshot 1`] = `
- No Contacts match the search criteria +
+
+
+ + + + + + + + + + +
+
+ + + +
+ +
+ first +
+
+ last +
+
+
+ email +
+
+ 123 mock st +
+
+ city +
+
+ province +
+
+
+ +
+
+
+
matches snapshot 1`] = ` >
+ > + + 1 - 1 of 1 + +
+ > + +
+
+ +
diff --git a/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/PropertyDetailsTabView.test.tsx b/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/PropertyDetailsTabView.test.tsx index 2d8cab9573..e8e11085e2 100644 --- a/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/PropertyDetailsTabView.test.tsx +++ b/source/frontend/src/features/mapSideBar/property/tabs/propertyDetails/detail/PropertyDetailsTabView.test.tsx @@ -66,7 +66,7 @@ describe('PropertyDetailsTabView component', () => { return { ...component }; }; - afterEach(() => { + beforeEach(() => { vi.clearAllMocks(); }); diff --git a/source/frontend/vite.config.ts b/source/frontend/vite.config.ts index 9ea7c30804..b0835ea35b 100644 --- a/source/frontend/vite.config.ts +++ b/source/frontend/vite.config.ts @@ -14,6 +14,7 @@ export default defineConfig({ environment: 'jsdom', coverage: { reporter: [['lcov'], ['text'], ['json', { file: 'coverage-final.json' }]], + reportOnFailure: false, include: ['src/**/*.{js,jsx,ts,tsx}'], exclude: [ 'node_modules/**', @@ -46,7 +47,7 @@ export default defineConfig({ }, }, pool: 'vmThreads', - maxConcurrency: 8, + maxConcurrency: 32, }, resolve: { alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],