@openneuro/app 4.12.6 → 4.13.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -32
- package/src/scripts/common/containers/__tests__/header.spec.tsx +12 -15
- package/src/scripts/common/forms/__tests__/__snapshots__/warn-button.spec.jsx.snap +3 -3
- package/src/scripts/datalad/subscriptions/__tests__/__snapshots__/files-subscription.spec.jsx.snap +2 -2
- package/src/scripts/dataset/__tests__/__snapshots__/snapshot-container.spec.tsx.snap +17 -17
- package/src/scripts/dataset/__tests__/snapshot-container.spec.tsx +3 -0
- package/src/scripts/dataset/comments/__tests__/__snapshots__/comment.spec.jsx.snap +3 -3
- package/src/scripts/dataset/comments/__tests__/__snapshots__/comments.spec.jsx.snap +3 -3
- package/src/scripts/dataset/comments/__tests__/comment.spec.jsx +1 -1
- package/src/scripts/dataset/comments/__tests__/comments.spec.jsx +3 -0
- package/src/scripts/dataset/download/__tests__/__snapshots__/download-command-line.spec.jsx.snap +2 -2
- package/src/scripts/dataset/download/__tests__/__snapshots__/download-link.spec.jsx.snap +2 -2
- package/src/scripts/dataset/download/__tests__/__snapshots__/shell-example.spec.jsx.snap +2 -2
- package/src/scripts/dataset/download/__tests__/download-link.spec.jsx +4 -0
- package/src/scripts/dataset/download/__tests__/download-native.spec.js +4 -4
- package/src/scripts/dataset/files/__tests__/__snapshots__/file-tree.spec.jsx.snap +2 -2
- package/src/scripts/dataset/files/__tests__/__snapshots__/file.spec.jsx.snap +3 -3
- package/src/scripts/dataset/files/__tests__/file-tree-unloaded-directory.spec.jsx +1 -1
- package/src/scripts/dataset/files/__tests__/file-tree.spec.jsx +2 -2
- package/src/scripts/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +3 -3
- package/src/scripts/dataset/fragments/__tests__/__snapshots__/cancel-button.spec.tsx.snap +2 -2
- package/src/scripts/dataset/fragments/__tests__/__snapshots__/edit-button.spec.tsx.snap +2 -2
- package/src/scripts/dataset/fragments/__tests__/__snapshots__/edit-list.spec.jsx.snap +2 -2
- package/src/scripts/dataset/fragments/__tests__/__snapshots__/save-button.spec.tsx.snap +2 -2
- package/src/scripts/dataset/fragments/__tests__/__snapshots__/select-input.spec.tsx.snap +4 -4
- package/src/scripts/dataset/fragments/__tests__/edit-list.spec.jsx +1 -1
- package/src/scripts/dataset/mutations/__tests__/__snapshots__/delete.spec.jsx.snap +3 -3
- package/src/scripts/dataset/mutations/__tests__/__snapshots__/deprecate-snapshot.spec.tsx.snap +2 -2
- package/src/scripts/dataset/mutations/__tests__/__snapshots__/deprecate-version.spec.tsx.snap +2 -2
- package/src/scripts/dataset/mutations/__tests__/__snapshots__/description.spec.jsx.snap +2 -2
- package/src/scripts/dataset/mutations/__tests__/__snapshots__/update-permissions.spec.jsx.snap +3 -3
- package/src/scripts/dataset/mutations/__tests__/delete.spec.jsx +5 -6
- package/src/scripts/dataset/mutations/__tests__/deprecate-snapshot.spec.tsx +2 -1
- package/src/scripts/dataset/mutations/__tests__/deprecate-version.spec.tsx +2 -1
- package/src/scripts/dataset/mutations/__tests__/description.spec.jsx +6 -6
- package/src/scripts/dataset/mutations/__tests__/update-permissions.spec.jsx +1 -1
- package/src/scripts/dataset/snapshot-container.tsx +9 -0
- package/src/scripts/pages/faq/__tests__/__snapshots__/faq.spec.jsx.snap +2 -2
- package/src/scripts/resources/__tests__/kibana.spec.js +3 -0
- package/src/scripts/search/__tests__/search-container.spec.tsx +4 -3
- package/src/scripts/utils/__tests__/userNotify.spec.js +5 -5
- package/jestsetup.ts +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openneuro/app",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0-alpha.0",
|
|
4
4
|
"description": "React JS web frontend for the OpenNeuro platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "public/client.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@emotion/react": "11.6.0",
|
|
21
21
|
"@emotion/styled": "11.6.0",
|
|
22
22
|
"@niivue/niivue": "0.23.1",
|
|
23
|
-
"@openneuro/client": "^4.
|
|
24
|
-
"@openneuro/components": "^4.
|
|
23
|
+
"@openneuro/client": "^4.13.0-alpha.0",
|
|
24
|
+
"@openneuro/components": "^4.13.0-alpha.0",
|
|
25
25
|
"bids-validator": "1.9.9",
|
|
26
26
|
"bytes": "^3.0.0",
|
|
27
27
|
"comlink": "^4.0.5",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"react-helmet": "6.1.0",
|
|
41
41
|
"react-router-dom": "6.3.0",
|
|
42
42
|
"react-toastify": "6.0.9",
|
|
43
|
-
"react-usestateref": "^1.0.
|
|
43
|
+
"react-usestateref": "^1.0.8",
|
|
44
44
|
"react-virtualized": "remorses/react-virtualized-fixed-import.git#9.22.3",
|
|
45
45
|
"semver": "^5.5.0",
|
|
46
46
|
"subscriptions-transport-ws": "0.11.0",
|
|
@@ -58,51 +58,28 @@
|
|
|
58
58
|
"@babel/preset-typescript": "^7.7.4",
|
|
59
59
|
"@babel/runtime": "^7.6.3",
|
|
60
60
|
"@babel/runtime-corejs3": "^7.13.10",
|
|
61
|
-
"@jest/globals": "^26.6.2",
|
|
62
61
|
"@testing-library/jest-dom": "^5.11.4",
|
|
63
62
|
"@testing-library/react": "^11.1.0",
|
|
64
|
-
"@types/jest": "^26.0.22",
|
|
65
63
|
"@types/jsdom": "^16",
|
|
66
|
-
"@types/node": "
|
|
64
|
+
"@types/node": "18.11.9",
|
|
67
65
|
"@types/react": "^17.0.8",
|
|
68
66
|
"@types/react-dom": "^17.0.5",
|
|
69
67
|
"@types/react-router-dom": "5.3.3",
|
|
70
|
-
"@types/testing-library__jest-dom": "
|
|
71
|
-
"babel-jest": "29.0.2",
|
|
68
|
+
"@types/testing-library__jest-dom": "5.14.5",
|
|
72
69
|
"core-js": "3.25.1",
|
|
73
70
|
"esbuild-plugin-globals": "^0.1.1",
|
|
74
71
|
"history": "5.3.0",
|
|
75
|
-
"jest": "27.5.1",
|
|
76
|
-
"jest-fetch-mock": "^1.4.1",
|
|
77
72
|
"jsdom": "^16.5.3",
|
|
78
73
|
"object.fromentries": "^2.0.0",
|
|
79
74
|
"rollup-plugin-polyfill-node": "^0.9.0",
|
|
80
75
|
"sass": "^1.32.8",
|
|
81
76
|
"stream-browserify": "^3.0.0",
|
|
82
77
|
"typescript": "4.5.4",
|
|
83
|
-
"vite": "3.
|
|
84
|
-
|
|
85
|
-
"jest": {
|
|
86
|
-
"testEnvironment": "jsdom",
|
|
87
|
-
"setupFilesAfterEnv": [
|
|
88
|
-
"./jestsetup.ts"
|
|
89
|
-
],
|
|
90
|
-
"moduleNameMapper": {
|
|
91
|
-
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
|
|
92
|
-
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
|
|
93
|
-
"^.+\\.(scss)$": "babel-jest",
|
|
94
|
-
"@openneuro/components/(.+)": "<rootDir>../openneuro-components/src/$1",
|
|
95
|
-
"@openneuro/(.+)": "<rootDir>../openneuro-$1/src"
|
|
96
|
-
},
|
|
97
|
-
"transformIgnorePatterns": [
|
|
98
|
-
"/node_modules/(?!bids-validator|@niivue/niivue).+\\.js$"
|
|
99
|
-
],
|
|
100
|
-
"testPathIgnorePatterns": [
|
|
101
|
-
"dist"
|
|
102
|
-
]
|
|
78
|
+
"vite": "3.2.3",
|
|
79
|
+
"vitest": "^0.25.2"
|
|
103
80
|
},
|
|
104
81
|
"publishConfig": {
|
|
105
82
|
"access": "public"
|
|
106
83
|
},
|
|
107
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "fe4c230250d73e24a758a0bce058b23aa93d0aee"
|
|
108
85
|
}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
+
import { vi } from 'vitest'
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { MockAppShell } from '../../../__utils__/mock-app-shell'
|
|
3
4
|
import { render, screen, fireEvent, waitFor } from '@testing-library/react'
|
|
4
5
|
import { HeaderContainer } from '../header'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
...reactRouterDom,
|
|
17
|
-
useNavigate: () => mockNavigate,
|
|
18
|
-
}
|
|
19
|
-
})
|
|
7
|
+
const navigate = vi.fn()
|
|
8
|
+
vi.mock('../../../config.ts')
|
|
9
|
+
vi.mock('../../../uploader/uploader-view.jsx', () => ({
|
|
10
|
+
default: () => 'mocked UploaderView',
|
|
11
|
+
}))
|
|
12
|
+
vi.mock('react-router-dom', async () => ({
|
|
13
|
+
// @ts-ignore-check
|
|
14
|
+
...(await vi.importActual('react-router-dom')),
|
|
15
|
+
useNavigate: () => navigate,
|
|
16
|
+
}))
|
|
20
17
|
|
|
21
18
|
describe('HeaderContainer component', () => {
|
|
22
19
|
it('navigates prepopulated search when you use the home page search box', async () => {
|
|
@@ -26,7 +23,7 @@ describe('HeaderContainer component', () => {
|
|
|
26
23
|
await fireEvent.change(searchbox, { target: { value: 'test argument' } })
|
|
27
24
|
await fireEvent.click(button)
|
|
28
25
|
await waitFor(() =>
|
|
29
|
-
expect(
|
|
26
|
+
expect(navigate).toHaveBeenCalledWith(
|
|
30
27
|
'/search?query={"keywords":["test argument"]}',
|
|
31
28
|
),
|
|
32
29
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`common/forms/WarnButton renders successfully 1`] = `
|
|
3
|
+
exports[`common/forms/WarnButton > renders successfully 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<span
|
|
6
6
|
class=""
|
|
@@ -17,7 +17,7 @@ exports[`common/forms/WarnButton renders successfully 1`] = `
|
|
|
17
17
|
</DocumentFragment>
|
|
18
18
|
`;
|
|
19
19
|
|
|
20
|
-
exports[`common/forms/WarnButton renders with warnings disable 1`] = `
|
|
20
|
+
exports[`common/forms/WarnButton > renders with warnings disable 1`] = `
|
|
21
21
|
<DocumentFragment>
|
|
22
22
|
<span
|
|
23
23
|
class=""
|
package/src/scripts/datalad/subscriptions/__tests__/__snapshots__/files-subscription.spec.jsx.snap
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`FilesSubscription renders with common props 1`] = `<DocumentFragment />`;
|
|
3
|
+
exports[`FilesSubscription > renders with common props 1`] = `<DocumentFragment />`;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`SnapshotContainer component includes JSON-LD data in the header 1`] = `
|
|
4
|
-
|
|
5
|
-
"baseTag":
|
|
6
|
-
"bodyAttributes":
|
|
3
|
+
exports[`SnapshotContainer component > includes JSON-LD data in the header 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"baseTag": [],
|
|
6
|
+
"bodyAttributes": {},
|
|
7
7
|
"defer": true,
|
|
8
8
|
"encode": true,
|
|
9
|
-
"htmlAttributes":
|
|
10
|
-
"linkTags":
|
|
11
|
-
"metaTags":
|
|
12
|
-
"noscriptTags":
|
|
9
|
+
"htmlAttributes": {},
|
|
10
|
+
"linkTags": [],
|
|
11
|
+
"metaTags": [],
|
|
12
|
+
"noscriptTags": [],
|
|
13
13
|
"onChangeClientState": [Function],
|
|
14
|
-
"scriptTags":
|
|
15
|
-
|
|
14
|
+
"scriptTags": [
|
|
15
|
+
{
|
|
16
16
|
"innerHTML": "{\\"@context\\":\\"http://schema.org\\",\\"@type\\":\\"Dataset\\",\\"name\\":\\"DS003-downsampled (only T1)\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"J. Doe\\",\\"givenName\\":\\"J.\\",\\"familyName\\":\\"Doe\\"},{\\"@type\\":\\"Person\\",\\"name\\":\\"J. Doe\\",\\"givenName\\":\\"J.\\",\\"familyName\\":\\"Doe\\"},{\\"@type\\":\\"Person\\",\\"name\\":\\"J. Doe\\",\\"givenName\\":\\"J.\\",\\"familyName\\":\\"Doe\\"}],\\"datePublished\\":\\"2021-12-17T22:32:08.000Z\\",\\"dateModified\\":\\"2021-12-17T22:32:08.000Z\\",\\"license\\":\\"https://creativecommons.org/publicdomain/zero/1.0/\\",\\"publisher\\":{\\"@type\\":\\"Organization\\",\\"name\\":\\"OpenNeuro\\"},\\"description\\":\\"This dataset was obtained from the OpenfMRI project (http://www.openfmri.org).\\\\nAccession #: ds003\\\\nDescription: Rhyme judgment\\\\n\\\\nRelease history:\\\\n10/06/2011: initial release\\\\n3/21/2013: Updated release with QA information\\\\n\\\\nThis dataset is made available under the Public Domain Dedication and License \\\\nv1.0, whose full text can be found at \\\\nhttp://www.opendatacommons.org/licenses/pddl/1.0/. \\\\nWe hope that all users will follow the ODC Attribution/Share-Alike \\\\nCommunity Norms (http://www.opendatacommons.org/norms/odc-by-sa/); \\\\nin particular, while not legally required, we hope that all users \\\\nof the data will acknowledge the OpenfMRI project and NSF Grant \\\\nOCI-1131441 (R. Poldrack, PI) in any publications.\\\\n\\",\\"version\\":\\"1.0.0\\",\\"url\\":\\"https://openneuro.org/datasets/ds001032/versions/1.0.0\\"}",
|
|
17
17
|
"type": "application/ld+json",
|
|
18
18
|
},
|
|
19
19
|
],
|
|
20
|
-
"styleTags":
|
|
21
|
-
"title":
|
|
20
|
+
"styleTags": [],
|
|
21
|
+
"title": [
|
|
22
22
|
"DS003-downsampled (only T1)",
|
|
23
23
|
" - ",
|
|
24
24
|
"OpenNeuro",
|
|
25
25
|
],
|
|
26
|
-
"titleAttributes":
|
|
26
|
+
"titleAttributes": {},
|
|
27
27
|
}
|
|
28
28
|
`;
|
|
29
29
|
|
|
30
|
-
exports[`SnapshotContainer component renders successfully 1`] = `
|
|
30
|
+
exports[`SnapshotContainer component > renders successfully 1`] = `
|
|
31
31
|
<DocumentFragment>
|
|
32
32
|
<div
|
|
33
33
|
class="dataset dataset-draft dataset-page dataset-page-mri"
|
|
@@ -1454,7 +1454,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
|
|
|
1454
1454
|
>
|
|
1455
1455
|
Uploaded by
|
|
1456
1456
|
</h2>
|
|
1457
|
-
Test User on 2021-12-17 -
|
|
1457
|
+
Test User on 2021-12-17 - 11 months ago
|
|
1458
1458
|
</div>
|
|
1459
1459
|
<div
|
|
1460
1460
|
class="dataset-meta-block undefined"
|
|
@@ -1464,7 +1464,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
|
|
|
1464
1464
|
>
|
|
1465
1465
|
Last Updated
|
|
1466
1466
|
</h2>
|
|
1467
|
-
2021-12-17 -
|
|
1467
|
+
2021-12-17 - 11 months ago
|
|
1468
1468
|
</div>
|
|
1469
1469
|
<div
|
|
1470
1470
|
class="dataset-meta-block undefined"
|
|
@@ -5,6 +5,9 @@ import '@testing-library/jest-dom/extend-expect'
|
|
|
5
5
|
import { SnapshotContainer } from '../snapshot-container'
|
|
6
6
|
import { MockAppWrapper } from '../../fixtures/mock-app-wrapper'
|
|
7
7
|
import { dataset, snapshot } from '../../fixtures/dataset-query'
|
|
8
|
+
import { vi } from 'vitest'
|
|
9
|
+
|
|
10
|
+
vi.mock('../../config.ts')
|
|
8
11
|
|
|
9
12
|
const defProps = {
|
|
10
13
|
dataset,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`Comment component renders with an empty comment 1`] = `
|
|
4
|
-
|
|
3
|
+
exports[`Comment component > renders with an empty comment 1`] = `
|
|
4
|
+
{
|
|
5
5
|
"asFragment": [Function],
|
|
6
6
|
"baseElement": <body>
|
|
7
7
|
<div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`Comments component recursively renders a tree of comments 1`] = `
|
|
3
|
+
exports[`Comments component > recursively renders a tree of comments 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="dataset-comments"
|
|
@@ -15,7 +15,7 @@ exports[`Comments component recursively renders a tree of comments 1`] = `
|
|
|
15
15
|
</DocumentFragment>
|
|
16
16
|
`;
|
|
17
17
|
|
|
18
|
-
exports[`Comments component renders one top level comment 1`] = `
|
|
18
|
+
exports[`Comments component > renders one top level comment 1`] = `
|
|
19
19
|
<DocumentFragment>
|
|
20
20
|
<div
|
|
21
21
|
class="dataset-comments"
|
|
@@ -3,7 +3,7 @@ import { render } from '@testing-library/react'
|
|
|
3
3
|
import Comment from '../comment.jsx'
|
|
4
4
|
import formatDistanceToNow from 'date-fns/formatDistanceToNow'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
vi.mock('date-fns/formatDistanceToNow')
|
|
7
7
|
|
|
8
8
|
const emptyState =
|
|
9
9
|
'{"blocks":[{"key":"3sm42","text":"","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}'
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render } from '@testing-library/react'
|
|
3
3
|
import Comments from '../comments.jsx'
|
|
4
|
+
import { vi } from 'vitest'
|
|
5
|
+
|
|
6
|
+
vi.mock('../../../config.ts')
|
|
4
7
|
|
|
5
8
|
const emptyState =
|
|
6
9
|
'{"blocks":[{"key":"3sm42","text":"","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}'
|
package/src/scripts/dataset/download/__tests__/__snapshots__/download-command-line.spec.jsx.snap
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`dataset/download DownloadSampleCommand component renders successfully 1`] = `
|
|
3
|
+
exports[`dataset/download > DownloadSampleCommand component > renders successfully 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<pre
|
|
6
6
|
class="css-xak41w"
|
|
@@ -2,6 +2,10 @@ import React from 'react'
|
|
|
2
2
|
import { render } from '@testing-library/react'
|
|
3
3
|
import DownloadLink from '../download-link.jsx'
|
|
4
4
|
import { MockedProvider } from '@apollo/client/testing'
|
|
5
|
+
import { vi } from 'vitest'
|
|
6
|
+
|
|
7
|
+
vi.mock('../../../config.ts')
|
|
8
|
+
|
|
5
9
|
const defProps = {
|
|
6
10
|
datasetId: 'ds000001',
|
|
7
11
|
snapshotTag: '1.0.0',
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { openFileTree } from '../download-native.js'
|
|
2
2
|
|
|
3
|
+
vi.mock('../../../config.ts')
|
|
4
|
+
|
|
3
5
|
describe('dataset/download - native file API method', () => {
|
|
4
6
|
describe('openFileTree', () => {
|
|
5
7
|
it('iterates over directory to correct depth', async () => {
|
|
6
8
|
const mockDirectoryHandle = {}
|
|
7
9
|
const mockFile = Symbol('mockFile')
|
|
8
|
-
mockDirectoryHandle.getDirectoryHandle =
|
|
9
|
-
|
|
10
|
-
)
|
|
11
|
-
mockDirectoryHandle.getFileHandle = jest.fn(() => mockFile)
|
|
10
|
+
mockDirectoryHandle.getDirectoryHandle = vi.fn(() => mockDirectoryHandle)
|
|
11
|
+
mockDirectoryHandle.getFileHandle = vi.fn(() => mockFile)
|
|
12
12
|
expect(
|
|
13
13
|
await openFileTree(mockDirectoryHandle, 'sub-01/anat/something.nii.gz'),
|
|
14
14
|
).toBe(mockFile)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`File component renders for dataset snapshots 1`] = `
|
|
3
|
+
exports[`File component > renders for dataset snapshots 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<span
|
|
6
6
|
aria-label=""
|
|
@@ -61,7 +61,7 @@ exports[`File component renders for dataset snapshots 1`] = `
|
|
|
61
61
|
</DocumentFragment>
|
|
62
62
|
`;
|
|
63
63
|
|
|
64
|
-
exports[`File component renders with common props 1`] = `
|
|
64
|
+
exports[`File component > renders with common props 1`] = `
|
|
65
65
|
<DocumentFragment>
|
|
66
66
|
<span
|
|
67
67
|
aria-label=""
|
|
@@ -11,7 +11,7 @@ const dir = {
|
|
|
11
11
|
|
|
12
12
|
describe('FileTreeUnloadedDirectory component', () => {
|
|
13
13
|
it('calls fetchMoreDirectory when clicked', () => {
|
|
14
|
-
const fetchMore =
|
|
14
|
+
const fetchMore = vi.fn()
|
|
15
15
|
render(
|
|
16
16
|
<DatasetQueryContext.Provider value={{ fetchMore }}>
|
|
17
17
|
<FileTreeUnloadedDirectory datasetId={'ds000001'} directory={dir} />
|
package/src/scripts/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`File Viewer - JSON renders with invalid JSON 1`] = `
|
|
3
|
+
exports[`File Viewer - JSON > renders with invalid JSON 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<h3>
|
|
6
6
|
Tree
|
|
@@ -24,7 +24,7 @@ exports[`File Viewer - JSON renders with invalid JSON 1`] = `
|
|
|
24
24
|
</DocumentFragment>
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
|
-
exports[`File Viewer - JSON renders with valid JSON 1`] = `
|
|
27
|
+
exports[`File Viewer - JSON > renders with valid JSON 1`] = `
|
|
28
28
|
<DocumentFragment>
|
|
29
29
|
<h3>
|
|
30
30
|
Tree
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`SelectInput handles boolean display 1`] = `
|
|
3
|
+
exports[`SelectInput > handles boolean display 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="css-1e7yhge"
|
|
@@ -77,7 +77,7 @@ exports[`SelectInput handles boolean display 1`] = `
|
|
|
77
77
|
</DocumentFragment>
|
|
78
78
|
`;
|
|
79
79
|
|
|
80
|
-
exports[`SelectInput handles display as disabled 1`] = `
|
|
80
|
+
exports[`SelectInput > handles display as disabled 1`] = `
|
|
81
81
|
<DocumentFragment>
|
|
82
82
|
<div
|
|
83
83
|
class="css-1e7yhge"
|
|
@@ -154,7 +154,7 @@ exports[`SelectInput handles display as disabled 1`] = `
|
|
|
154
154
|
</DocumentFragment>
|
|
155
155
|
`;
|
|
156
156
|
|
|
157
|
-
exports[`SelectInput handles display as not disabled 1`] = `
|
|
157
|
+
exports[`SelectInput > handles display as not disabled 1`] = `
|
|
158
158
|
<DocumentFragment>
|
|
159
159
|
<div
|
|
160
160
|
class="css-1e7yhge"
|
|
@@ -9,7 +9,7 @@ describe('EditList component', () => {
|
|
|
9
9
|
})
|
|
10
10
|
it('calls setElements when an item is added', () => {
|
|
11
11
|
const testText = 'this is a test entry'
|
|
12
|
-
const setElements =
|
|
12
|
+
const setElements = vi.fn()
|
|
13
13
|
render(<EditList setElements={setElements} />)
|
|
14
14
|
fireEvent.change(screen.getByRole('textbox'), {
|
|
15
15
|
target: { value: testText },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`DeleteDataset mutation renders with common props 1`] = `
|
|
3
|
+
exports[`DeleteDataset mutation > renders with common props 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<span>
|
|
6
6
|
<button
|
|
@@ -15,7 +15,7 @@ exports[`DeleteDataset mutation renders with common props 1`] = `
|
|
|
15
15
|
</DocumentFragment>
|
|
16
16
|
`;
|
|
17
17
|
|
|
18
|
-
exports[`DeleteDir mutation renders with common props 1`] = `
|
|
18
|
+
exports[`DeleteDir mutation > renders with common props 1`] = `
|
|
19
19
|
<DocumentFragment>
|
|
20
20
|
<span
|
|
21
21
|
class="delete-file"
|
package/src/scripts/dataset/mutations/__tests__/__snapshots__/deprecate-snapshot.spec.tsx.snap
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`DeprecateVersion mutation renders with typical props 1`] = `
|
|
3
|
+
exports[`DeprecateVersion mutation > renders with typical props 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<button
|
|
6
6
|
aria-label="Deprecate Version"
|
package/src/scripts/dataset/mutations/__tests__/__snapshots__/deprecate-version.spec.tsx.snap
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`DeprecateVersion mutation renders with typical props 1`] = `
|
|
3
|
+
exports[`DeprecateVersion mutation > renders with typical props 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<button
|
|
6
6
|
aria-label="Deprecate Version"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`UpdateDescription mutation renders with common props 1`] = `
|
|
3
|
+
exports[`UpdateDescription mutation > renders with common props 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
Mutation mock
|
|
6
6
|
</DocumentFragment>
|
package/src/scripts/dataset/mutations/__tests__/__snapshots__/update-permissions.spec.jsx.snap
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1
|
|
2
2
|
|
|
3
|
-
exports[`UpdateDatasetPermissions mutation renders with default props 1`] = `
|
|
3
|
+
exports[`UpdateDatasetPermissions mutation > renders with default props 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<button
|
|
6
6
|
aria-label="Share"
|
|
@@ -13,7 +13,7 @@ exports[`UpdateDatasetPermissions mutation renders with default props 1`] = `
|
|
|
13
13
|
</DocumentFragment>
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
|
-
exports[`UpdateDatasetPermissions mutation renders with typical props 1`] = `
|
|
16
|
+
exports[`UpdateDatasetPermissions mutation > renders with typical props 1`] = `
|
|
17
17
|
<DocumentFragment>
|
|
18
18
|
<button
|
|
19
19
|
aria-label="Share"
|
|
@@ -15,7 +15,7 @@ const deleteDatasetMock = {
|
|
|
15
15
|
reason: 'test suite delete',
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
|
-
newData:
|
|
18
|
+
newData: vi.fn(() => ({
|
|
19
19
|
data: {},
|
|
20
20
|
})),
|
|
21
21
|
}
|
|
@@ -28,7 +28,7 @@ const deleteDirMock = {
|
|
|
28
28
|
files: [{ path: 'sub-99' }],
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
|
-
newData:
|
|
31
|
+
newData: vi.fn(() => ({
|
|
32
32
|
data: {},
|
|
33
33
|
})),
|
|
34
34
|
}
|
|
@@ -60,7 +60,7 @@ describe('DeleteDir mutation', () => {
|
|
|
60
60
|
)
|
|
61
61
|
expect(asFragment()).toMatchSnapshot()
|
|
62
62
|
})
|
|
63
|
-
it('fires the correct mutation',
|
|
63
|
+
it('fires the correct mutation', async () => {
|
|
64
64
|
render(
|
|
65
65
|
<MockedProvider mocks={[deleteDirMock]} addTypename={false}>
|
|
66
66
|
<DeleteDir {...{ datasetId, path }} />
|
|
@@ -68,11 +68,10 @@ describe('DeleteDir mutation', () => {
|
|
|
68
68
|
)
|
|
69
69
|
|
|
70
70
|
// click "Delete" button
|
|
71
|
-
fireEvent.click(screen.getByRole('button'))
|
|
71
|
+
await fireEvent.click(screen.getByRole('button'))
|
|
72
72
|
// confirm delete
|
|
73
|
-
fireEvent.click(screen.getByLabelText('confirm'))
|
|
73
|
+
await fireEvent.click(screen.getByLabelText('confirm'))
|
|
74
74
|
|
|
75
75
|
expect(deleteDirMock.newData).toHaveBeenCalled()
|
|
76
|
-
done()
|
|
77
76
|
})
|
|
78
77
|
})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { render, fireEvent, screen, waitFor } from '@testing-library/react'
|
|
3
4
|
import { createMemoryHistory } from 'history'
|
|
@@ -27,7 +28,7 @@ describe('DeprecateVersion mutation', () => {
|
|
|
27
28
|
const history = createMemoryHistory({
|
|
28
29
|
initialEntries: [`/datasets/${datasetId}/versions/${tag}/deprecate`],
|
|
29
30
|
})
|
|
30
|
-
const historyPushSpy =
|
|
31
|
+
const historyPushSpy = vi.spyOn(history, 'push')
|
|
31
32
|
const snapshotId = `${datasetId}:${tag}`
|
|
32
33
|
const deprecateSnapshotMock = {
|
|
33
34
|
request: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { render, fireEvent, screen, waitFor } from '@testing-library/react'
|
|
3
4
|
import { MockedProvider } from '@apollo/client/testing'
|
|
@@ -35,7 +36,7 @@ describe('DeprecateVersion mutation', () => {
|
|
|
35
36
|
const history = createMemoryHistory({
|
|
36
37
|
initialEntries: [`/datasets/${datasetId}/versions/${tag}/deprecate`],
|
|
37
38
|
})
|
|
38
|
-
const historyPushSpy =
|
|
39
|
+
const historyPushSpy = vi.spyOn(history, 'push')
|
|
39
40
|
const snapshotId = `${datasetId}:${tag}`
|
|
40
41
|
const deprecateSnapshotMock = {
|
|
41
42
|
request: {
|
|
@@ -7,9 +7,9 @@ import UpdateDescription, {
|
|
|
7
7
|
UPDATE_DESCRIPTION_LIST,
|
|
8
8
|
} from '../description.jsx'
|
|
9
9
|
|
|
10
|
-
const mockMutation =
|
|
11
|
-
|
|
12
|
-
...
|
|
10
|
+
const mockMutation = vi.fn()
|
|
11
|
+
vi.mock('@apollo/client/react/components', () => ({
|
|
12
|
+
...vi.importActual('@apollo/client/react/components'),
|
|
13
13
|
Mutation: props => {
|
|
14
14
|
mockMutation(props)
|
|
15
15
|
return <>Mutation mock</>
|
|
@@ -23,7 +23,7 @@ describe('UpdateDescription mutation', () => {
|
|
|
23
23
|
datasetId="ds001"
|
|
24
24
|
field="Name"
|
|
25
25
|
value="New Name"
|
|
26
|
-
done={
|
|
26
|
+
done={vi.fn()}
|
|
27
27
|
/>,
|
|
28
28
|
{ wrapper: MockedProvider },
|
|
29
29
|
)
|
|
@@ -35,7 +35,7 @@ describe('UpdateDescription mutation', () => {
|
|
|
35
35
|
datasetId="ds001"
|
|
36
36
|
field="Name"
|
|
37
37
|
value="New Name"
|
|
38
|
-
done={
|
|
38
|
+
done={vi.fn()}
|
|
39
39
|
/>,
|
|
40
40
|
{ wrapper: MockedProvider },
|
|
41
41
|
)
|
|
@@ -49,7 +49,7 @@ describe('UpdateDescription mutation', () => {
|
|
|
49
49
|
datasetId="ds001"
|
|
50
50
|
field="Authors"
|
|
51
51
|
value={['John Doe', 'Jane Doe']}
|
|
52
|
-
done={
|
|
52
|
+
done={vi.fn()}
|
|
53
53
|
/>,
|
|
54
54
|
{ wrapper: MockedProvider },
|
|
55
55
|
)
|
|
@@ -16,6 +16,7 @@ import { DatasetAlertVersion } from './fragments/dataset-alert-version'
|
|
|
16
16
|
import {
|
|
17
17
|
ModalitiesMetaDataBlock,
|
|
18
18
|
MetaDataBlock,
|
|
19
|
+
NemarButton,
|
|
19
20
|
BrainLifeButton,
|
|
20
21
|
ValidationBlock,
|
|
21
22
|
CloneDropdown,
|
|
@@ -136,6 +137,14 @@ export const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
|
|
|
136
137
|
<ValidationBlock>
|
|
137
138
|
<Validation datasetId={dataset.id} issues={snapshot.issues} />
|
|
138
139
|
</ValidationBlock>
|
|
140
|
+
<NemarButton
|
|
141
|
+
datasetId={datasetId}
|
|
142
|
+
onNemar={
|
|
143
|
+
summary?.modalities.includes('EEG') ||
|
|
144
|
+
summary?.modalities.includes('iEEG') ||
|
|
145
|
+
summary?.modalities.includes('MEG')
|
|
146
|
+
}
|
|
147
|
+
/>
|
|
139
148
|
<BrainLifeButton
|
|
140
149
|
datasetId={datasetId}
|
|
141
150
|
onBrainlife={snapshot.onBrainlife}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
1
2
|
import { setDefaultSearch } from '../search-container'
|
|
2
3
|
|
|
3
4
|
describe('SearchContainer component', () => {
|
|
4
5
|
describe('setDefaultSearch', () => {
|
|
5
6
|
it('updates default state when a modality is provided differing from the default', () => {
|
|
6
7
|
const context = { modality_selected: 'MRI' }
|
|
7
|
-
const setContext =
|
|
8
|
+
const setContext = vi.fn()
|
|
8
9
|
setDefaultSearch(
|
|
9
10
|
'MRI',
|
|
10
11
|
context,
|
|
@@ -25,7 +26,7 @@ describe('SearchContainer component', () => {
|
|
|
25
26
|
modality_selected: 'MRI',
|
|
26
27
|
datasetType_selected: 'All Public',
|
|
27
28
|
}
|
|
28
|
-
const setContext =
|
|
29
|
+
const setContext = vi.fn().mockImplementation(arg => {
|
|
29
30
|
context = arg(context)
|
|
30
31
|
})
|
|
31
32
|
setDefaultSearch(
|
|
@@ -41,7 +42,7 @@ describe('SearchContainer component', () => {
|
|
|
41
42
|
modality_selected: 'PET',
|
|
42
43
|
datasetType_selected: 'All Public',
|
|
43
44
|
}
|
|
44
|
-
const setContext =
|
|
45
|
+
const setContext = vi.fn().mockImplementation(arg => {
|
|
45
46
|
context = arg(context)
|
|
46
47
|
})
|
|
47
48
|
setDefaultSearch(
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { expiringBanner } from '../userNotify.js'
|
|
2
|
-
|
|
2
|
+
import { toast } from 'react-toastify'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
...
|
|
6
|
-
toast: { warn:
|
|
4
|
+
vi.mock('react-toastify', () => ({
|
|
5
|
+
...vi.importActual('react-toastify'),
|
|
6
|
+
toast: { warn: vi.fn() },
|
|
7
7
|
}))
|
|
8
8
|
|
|
9
9
|
describe('userNotify.js', () => {
|
|
10
10
|
describe('expiringBanner', () => {
|
|
11
11
|
afterEach(() => {
|
|
12
|
-
|
|
12
|
+
vi.clearAllMocks()
|
|
13
13
|
})
|
|
14
14
|
it('is displayed before expiration time', () => {
|
|
15
15
|
const future = new Date()
|
package/jestsetup.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import fetch from 'jest-fetch-mock'
|
|
3
|
-
import fromEntries from 'object.fromentries'
|
|
4
|
-
import { jest } from '@jest/globals'
|
|
5
|
-
import '@testing-library/jest-dom'
|
|
6
|
-
import '@testing-library/jest-dom/extend-expect'
|
|
7
|
-
import './src/scripts/apm'
|
|
8
|
-
|
|
9
|
-
global.fetch = fetch
|
|
10
|
-
|
|
11
|
-
if (!Object.fromEntries) {
|
|
12
|
-
fromEntries.shim()
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
jest.mock('./src/scripts/config')
|