Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock file maintenance #452

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
"@emotion/cache": "11.13.0",
"@emotion/react": "11.13.0",
"@emotion/styled": "11.13.0",
"@hello-pangea/dnd": "^17.0.0",
"@hello-pangea/dnd": "17.0.0",
"@mui/base": "5.0.0-beta.40",
"@mui/icons-material": "5.16.2",
"@mui/material": "5.16.2",
"@mui/system": "5.16.2",
"@mui/x-date-pickers": "^6.19.0",
"@mui/x-date-pickers": "6.19.0",
"@reduxjs/toolkit": "2.4.0",
"@tanstack/react-query": "5.61.3",
"@tanstack/react-query-devtools": "5.61.3",
"@tanstack/react-table": "8.20.5",
"@types/node": "20.17.1",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitejs/plugin-react": "4.3.4",
"axios": "1.7.4",
"browserslist": "^4.23.0",
"browserslist-to-esbuild": "^2.1.1",
"browserslist": "4.24.2",
"browserslist-to-esbuild": "2.1.1",
"chart.js": "4.4.1",
"chartjs-plugin-zoom": "2.0.0",
"date-fns": "3.6.0",
Expand All @@ -38,11 +38,12 @@
"react-redux": "9.1.2",
"single-spa-react": "6.0.2",
"typescript": "5.6.2",
"vite": "^5.4.6"
"vite": "5.4.11"
},
"resolutions": {
"@testing-library/react/@testing-library/dom": "10.4.0",
"@mui/x-date-pickers@^6.19.0": "patch:@mui/x-date-pickers@npm%3A6.19.0#./.yarn/patches/@mui-x-date-pickers-npm-6.19.0-d448743c52.patch"
"nwsapi": "2.2.13",
"@types/react": "18.3.3",
"@mui/[email protected]": "patch:@mui/x-date-pickers@npm%3A6.19.0#./.yarn/patches/@mui-x-date-pickers-npm-6.19.0-d448743c52.patch"
},
"scripts": {
"dev": "vite --open",
Expand Down Expand Up @@ -82,41 +83,41 @@
],
"packageManager": "[email protected]",
"devDependencies": {
"@eslint/compat": "^1.1.1",
"@eslint/compat": "1.2.4",
"@playwright/test": "1.48.0",
"@tanstack/eslint-plugin-query": "^5.53.0",
"@tanstack/eslint-plugin-query": "5.62.1",
"@testing-library/cypress": "10.0.1",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "6.6.2",
"@testing-library/react": "16.0.0",
"@testing-library/user-event": "14.5.2",
"@types/eslint-plugin-jsx-a11y": "^6",
"@types/eslint-plugin-jsx-a11y": "6.10.0",
"@typescript-eslint/typescript-estree": "8.16.0",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/coverage-v8": "2.1.8",
"cross-env": "7.0.3",
"cypress": "13.16.0",
"cypress-delete-downloads-folder": "^0.0.5",
"cypress-delete-downloads-folder": "0.0.5",
"eslint": "9.16.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-cypress": "4.1.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-no-only-tests": "3.3.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "^7.35.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-testing-library": "^6.3.0",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-react-hooks": "5.1.0",
"eslint-plugin-testing-library": "6.5.0",
"express": "4.21.0",
"globals": "^15.9.0",
"jsdom": "^25.0.0",
"globals": "15.13.0",
"jsdom": "25.0.1",
"lint-staged": "15.2.0",
"prettier": "3.3.3",
"serve": "14.2.0",
"serve-static": "1.16.0",
"start-server-and-test": "2.0.0",
"typescript-eslint": "^8.4.0",
"vitest": "^2.0.5",
"vitest-canvas-mock": "^0.3.3",
"vitest-fail-on-console": "^0.7.0"
"typescript-eslint": "8.18.0",
"vitest": "2.1.8",
"vitest-canvas-mock": "0.3.3",
"vitest-fail-on-console": "0.7.1"
},
"msw": {
"workerDirectory": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exports[`Settings Menu Items component > renders dropdown only when menu is visi
Default Colour Map
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1ualgfl-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl css-1ualgfl-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
>
<div
aria-controls=":r0:"
Expand Down
86 changes: 45 additions & 41 deletions src/api/export.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook, waitFor } from '@testing-library/react';
import { act, renderHook, waitFor } from '@testing-library/react';
import axios from 'axios';
import { MockInstance } from 'vitest';
import { RootState } from '../state/store';
Expand Down Expand Up @@ -76,18 +76,18 @@ describe('useExportData', () => {
expect(axios.get).not.toHaveBeenCalled();
expect(result.current.isIdle).toBe(true);

result.current.mutate({
exportType: 'Selected Rows',
dataToExport: {
Scalars: true,
Images: false,
'Waveform CSVs': true,
'Waveform Images': false,
},
await act(async () => {
await result.current.mutateAsync({
exportType: 'Selected Rows',
dataToExport: {
Scalars: true,
Images: false,
'Waveform CSVs': true,
'Waveform Images': false,
},
});
});

await waitFor(() => result.current.isSuccess);

const params = new URLSearchParams();
params.append('order', 'metadata.timestamp desc');
params.append('projection', 'metadata.timestamp');
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('useExportData', () => {
responseType: 'blob',
});

expect(mockLink.href).toEqual('testObjectUrl');
expect(mockLink.href).toEqual('blob:testObjectUrl');
expect(mockLink.download).toEqual('scwcdownload.csv');
expect(mockLink.style.display).toEqual('none');

Expand All @@ -142,18 +142,18 @@ describe('useExportData', () => {
expect(axios.get).not.toHaveBeenCalled();
expect(result.current.isIdle).toBe(true);

result.current.mutate({
exportType: 'All Rows',
dataToExport: {
Scalars: false,
Images: true,
'Waveform CSVs': false,
'Waveform Images': true,
},
await act(async () => {
await result.current.mutateAsync({
exportType: 'All Rows',
dataToExport: {
Scalars: false,
Images: true,
'Waveform CSVs': false,
'Waveform Images': true,
},
});
});

await waitFor(() => result.current.isSuccess);

const params = new URLSearchParams();

params.append('order', 'metadata.timestamp desc');
Expand Down Expand Up @@ -192,7 +192,7 @@ describe('useExportData', () => {
responseType: 'blob',
});

expect(mockLink.href).toEqual('testObjectUrl');
expect(mockLink.href).toEqual('blob:testObjectUrl');
expect(mockLink.download).toEqual('imwidownload.csv');
expect(mockLink.style.display).toEqual('none');

Expand All @@ -208,14 +208,16 @@ describe('useExportData', () => {
expect(axios.get).not.toHaveBeenCalled();
expect(result.current.isIdle).toBe(true);

result.current.mutate({
exportType: 'Visible Rows',
dataToExport: {
Scalars: true,
Images: false,
'Waveform CSVs': false,
'Waveform Images': false,
},
await act(async () => {
await result.current.mutateAsync({
exportType: 'Visible Rows',
dataToExport: {
Scalars: true,
Images: false,
'Waveform CSVs': false,
'Waveform Images': false,
},
});
});

await waitFor(() => result.current.isSuccess);
Expand Down Expand Up @@ -257,7 +259,7 @@ describe('useExportData', () => {
responseType: 'blob',
});

expect(mockLink.href).toEqual('testObjectUrl');
expect(mockLink.href).toEqual('blob:testObjectUrl');
expect(mockLink.download).toEqual('scdownload.csv');
expect(mockLink.style.display).toEqual('none');

Expand All @@ -275,14 +277,16 @@ describe('useExportData', () => {
expect(axios.get).not.toHaveBeenCalled();
expect(result.current.isIdle).toBe(true);

result.current.mutate({
exportType: 'All Rows',
dataToExport: {
Scalars: true,
Images: false,
'Waveform CSVs': false,
'Waveform Images': false,
},
await act(async () => {
await result.current.mutateAsync({
exportType: 'All Rows',
dataToExport: {
Scalars: true,
Images: false,
'Waveform CSVs': false,
'Waveform Images': false,
},
});
});

await waitFor(() => result.current.isSuccess);
Expand Down Expand Up @@ -322,7 +326,7 @@ describe('useExportData', () => {
responseType: 'blob',
});

expect(mockLink.href).toEqual('testObjectUrl');
expect(mockLink.href).toEqual('blob:testObjectUrl');
expect(mockLink.download).toEqual('scdownload.csv');
expect(mockLink.style.display).toEqual('none');

Expand Down
18 changes: 9 additions & 9 deletions src/api/functions.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook, waitFor } from '@testing-library/react';
import { act, renderHook, waitFor } from '@testing-library/react';
import { FunctionOperator, ValidateFunctionState } from '../app.types';
import functionTokenJson from '../mocks/functionTokens.json';
import { hooksWrapperWithProviders } from '../testUtils';
Expand Down Expand Up @@ -98,10 +98,10 @@ describe('useValidateFunctions', () => {
});
expect(result.current.isIdle).toBe(true);

result.current.mutate([functions[3]]);

await waitFor(() => {
expect(result.current.isSuccess).toBeFalsy();
await act(async () => {
await expect(
result.current.mutateAsync([functions[3]])
).rejects.toThrowError();
});

expect(result.current.error?.response?.data).toEqual({
Expand All @@ -116,10 +116,10 @@ describe('useValidateFunctions', () => {
});
expect(result.current.isIdle).toBe(true);

result.current.mutate([functions[2]]);

await waitFor(() => {
expect(result.current.isSuccess).toBeFalsy();
await act(async () => {
await expect(
result.current.mutateAsync([functions[2]])
).rejects.toThrowError();
});

expect(result.current.error?.response?.data).toEqual({
Expand Down
10 changes: 5 additions & 5 deletions src/api/images.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('images api functions', () => {

params.set('original_image', 'true');

expect(result.current.data).toEqual('testObjectUrl');
expect(result.current.data).toEqual('blob:testObjectUrl');
expect(new URL(request.url).searchParams).toEqual(params);
});

Expand Down Expand Up @@ -88,7 +88,7 @@ describe('images api functions', () => {
JSON.stringify({ name: 'b', expression: 'CHANNEL_EFGHI' })
);

expect(result.current.data).toEqual('testObjectUrl');
expect(result.current.data).toEqual('blob:testObjectUrl');
expect(new URL(request.url).searchParams.toString()).toEqual(
params.toString()
);
Expand All @@ -112,7 +112,7 @@ describe('images api functions', () => {

params.set('original_image', 'true');

expect(result.current.data).toEqual('testObjectUrl');
expect(result.current.data).toEqual('blob:testObjectUrl');
expect(new URL(request.url).searchParams).toEqual(params);
});

Expand Down Expand Up @@ -144,7 +144,7 @@ describe('images api functions', () => {
params.set('lower_level', '5');
params.set('upper_level', '200');

expect(result.current.data).toEqual('testObjectUrl');
expect(result.current.data).toEqual('blob:testObjectUrl');
expect(new URL(request.url).searchParams).toEqual(params);
});

Expand Down Expand Up @@ -185,7 +185,7 @@ describe('images api functions', () => {
params.set('lower_level', '5');
params.set('upper_level', '200');

expect(result.current.data).toEqual('testObjectUrl');
expect(result.current.data).toEqual('blob:testObjectUrl');
expect(new URL(request.url).searchParams).toEqual(params);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ exports[`y-axis tab > renders correctly 1`] = `
Displayed table channels
</label>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-formControl css-i06ziq-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-formControl css-i06ziq-MuiInputBase-root-MuiOutlinedInput-root-MuiSelect-root"
>
<div
aria-controls=":r4:"
Expand Down
1 change: 1 addition & 0 deletions src/settingsMenuItems.component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe('Settings Menu Items component', () => {
within(extendedDropdown).getByRole('option', { name: 'afmhot' })
);

await waitFor(() => expect(extendedSelect).toHaveTextContent('afmhot'));
expect(
screen.getByRole('checkbox', {
name: 'Reverse Colour',
Expand Down
8 changes: 7 additions & 1 deletion src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ afterAll(() => server.close());
if (typeof window.URL.createObjectURL === 'undefined') {
// Required as a work-around for RTL/vitest environment not implementing the window.URL.createObjectURL method
Object.defineProperty(window.URL, 'createObjectURL', {
value: () => 'testObjectUrl',
value: () => 'blob:testObjectUrl',
});
}
if (typeof window.URL.revokeObjectURL === 'undefined') {
// Required as a work-around for RTL/vitest environment not implementing the window.URL.createObjectURL method
Object.defineProperty(window.URL, 'revokeObjectURL', {
value: () => {},
});
}

Expand Down
Loading
Loading