@openneuro/app 4.2.4 → 4.2.5-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.
Files changed (55) hide show
  1. package/jestsetup.ts +0 -5
  2. package/package.json +6 -12
  3. package/src/scripts/common/forms/__tests__/__snapshots__/warn-button.spec.jsx.snap +26 -26
  4. package/src/scripts/common/forms/__tests__/warn-button.spec.jsx +7 -5
  5. package/src/scripts/datalad/subscriptions/__tests__/__snapshots__/files-subscription.spec.jsx.snap +1 -159
  6. package/src/scripts/datalad/subscriptions/__tests__/files-subscription.spec.jsx +6 -3
  7. package/src/scripts/errors/errorRoute.jsx +4 -23
  8. package/src/scripts/faq/__tests__/__snapshots__/faq.spec.jsx.snap +183 -154
  9. package/src/scripts/faq/__tests__/faq.spec.jsx +3 -3
  10. package/src/scripts/refactor_2021/admin/admin.jsx +1 -7
  11. package/src/scripts/refactor_2021/dataset/comments/__tests__/__snapshots__/comments.spec.jsx.snap +12 -110
  12. package/src/scripts/refactor_2021/dataset/comments/__tests__/comments.spec.jsx +7 -5
  13. package/src/scripts/refactor_2021/dataset/dataset-routes.jsx +0 -11
  14. package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/download-command-line.spec.jsx.snap +8 -9
  15. package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/download-link.spec.jsx.snap +46 -1255
  16. package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/shell-example.spec.jsx.snap +3 -4
  17. package/src/scripts/refactor_2021/dataset/download/__tests__/download-command-line.spec.jsx +10 -11
  18. package/src/scripts/refactor_2021/dataset/download/__tests__/download-link.spec.jsx +3 -3
  19. package/src/scripts/refactor_2021/dataset/download/__tests__/shell-example.spec.jsx +3 -3
  20. package/src/scripts/refactor_2021/dataset/download/download-command-line.jsx +1 -1
  21. package/src/scripts/refactor_2021/dataset/draft-snapshot-routes.tsx +1 -6
  22. package/src/scripts/refactor_2021/dataset/files/__tests__/__snapshots__/file-tree.spec.jsx.snap +24 -49
  23. package/src/scripts/refactor_2021/dataset/files/__tests__/__snapshots__/file.spec.jsx.snap +74 -54
  24. package/src/scripts/refactor_2021/dataset/files/__tests__/file-tree-unloaded-directory.spec.jsx +4 -3
  25. package/src/scripts/refactor_2021/dataset/files/__tests__/file-tree.spec.jsx +23 -19
  26. package/src/scripts/refactor_2021/dataset/files/__tests__/file-viewer-type.spec.jsx +5 -3
  27. package/src/scripts/refactor_2021/dataset/files/__tests__/file.spec.jsx +21 -21
  28. package/src/scripts/refactor_2021/dataset/files/file.jsx +3 -2
  29. package/src/scripts/refactor_2021/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +85 -60
  30. package/src/scripts/refactor_2021/dataset/files/viewers/__tests__/file-viewer-json.spec.jsx +5 -5
  31. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/cancel-button.spec.tsx.snap +14 -6
  32. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/edit-button.spec.tsx.snap +14 -6
  33. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/save-button.spec.tsx.snap +14 -6
  34. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/select-input.spec.tsx.snap +178 -105
  35. package/src/scripts/refactor_2021/dataset/fragments/__tests__/cancel-button.spec.tsx +3 -3
  36. package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-button.spec.tsx +3 -3
  37. package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-list.spec.jsx +0 -1
  38. package/src/scripts/refactor_2021/dataset/fragments/__tests__/save-button.spec.tsx +3 -3
  39. package/src/scripts/refactor_2021/dataset/fragments/__tests__/select-input.spec.tsx +9 -9
  40. package/src/scripts/refactor_2021/dataset/fragments/select-input.tsx +1 -1
  41. package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/description.spec.jsx.snap +3 -277
  42. package/src/scripts/refactor_2021/dataset/mutations/__tests__/description.spec.jsx +22 -9
  43. package/src/scripts/refactor_2021/dataset/mutations/update-file.jsx +15 -19
  44. package/src/scripts/refactor_2021/dataset/routes/__tests__/__snapshots__/publish.spec.jsx.snap +3 -0
  45. package/src/scripts/refactor_2021/dataset/routes/__tests__/publish.spec.jsx +13 -0
  46. package/src/scripts/refactor_2021/routes.tsx +9 -9
  47. package/src/scripts/refactor_2021/uploader/uploader-setup-routes.jsx +4 -24
  48. package/src/scripts/refactor_2021/uploader/uploader-status-routes.jsx +1 -6
  49. package/src/scripts/common/forms/__tests__/__snapshots__/input.spec.jsx.snap +0 -13
  50. package/src/scripts/common/forms/__tests__/input.spec.jsx +0 -25
  51. package/src/scripts/common/forms/input.jsx +0 -98
  52. package/src/scripts/datalad/routes/__tests__/__snapshots__/publish.spec.jsx.snap +0 -14
  53. package/src/scripts/datalad/routes/__tests__/publish.spec.jsx +0 -10
  54. package/src/scripts/datalad/routes/mobile-class.tsx +0 -16
  55. package/src/scripts/datalad/routes/publish.jsx +0 -50
package/jestsetup.ts CHANGED
@@ -1,7 +1,4 @@
1
1
  import React from 'react'
2
- // Make Enzyme functions available in all test files without importing
3
- import Enzyme, { shallow, render, mount } from 'enzyme'
4
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17'
5
2
  import fetch from 'jest-fetch-mock'
6
3
  import fromEntries from 'object.fromentries'
7
4
  import { jest } from '@jest/globals'
@@ -9,8 +6,6 @@ import '@testing-library/jest-dom'
9
6
  import '@testing-library/jest-dom/extend-expect'
10
7
  import './src/scripts/apm'
11
8
 
12
- Enzyme.configure({ adapter: new Adapter() })
13
-
14
9
  global.fetch = fetch
15
10
 
16
11
  if (!Object.fromEntries) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openneuro/app",
3
- "version": "4.2.4",
3
+ "version": "4.2.5-alpha.0",
4
4
  "description": "React JS web frontend for the OpenNeuro platform.",
5
5
  "license": "MIT",
6
6
  "main": "public/client.js",
@@ -19,8 +19,8 @@
19
19
  "@elastic/apm-rum": "5.9.1",
20
20
  "@emotion/react": "11.6.0",
21
21
  "@emotion/styled": "11.6.0",
22
- "@openneuro/client": "^4.2.4",
23
- "@openneuro/components": "^4.2.4",
22
+ "@openneuro/client": "^4.2.5-alpha.0",
23
+ "@openneuro/components": "^4.2.5-alpha.0",
24
24
  "babel-runtime": "^6.26.0",
25
25
  "bids-validator": "1.8.8",
26
26
  "bytes": "^3.0.0",
@@ -30,7 +30,6 @@
30
30
  "date-fns": "^2.16.1",
31
31
  "draft-js": "^0.11.7",
32
32
  "email-validator": "^2.0.4",
33
- "enzyme-to-json": "^3.3.5",
34
33
  "express": "^4.17.1",
35
34
  "graphql": "14.7.0",
36
35
  "jwt-decode": "^2.2.0",
@@ -76,15 +75,13 @@
76
75
  "@testing-library/react": "^11.1.0",
77
76
  "@types/jest": "^26.0.22",
78
77
  "@types/jsdom": "^16",
79
- "@types/node": "^14.14.37",
78
+ "@types/node": "16.11.13",
80
79
  "@types/react": "^17.0.8",
81
80
  "@types/react-dom": "^17.0.5",
82
81
  "@types/react-router-dom": "5.1.8",
83
82
  "@types/testing-library__jest-dom": "^5.14.0",
84
- "@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
85
83
  "babel-core": "^7.0.0-bridge.0",
86
84
  "babel-jest": "^24.9.0",
87
- "enzyme": "3.9.0",
88
85
  "esbuild-plugin-globals": "^0.1.1",
89
86
  "jest": "^26.6.3",
90
87
  "jest-fetch-mock": "^1.4.1",
@@ -93,16 +90,13 @@
93
90
  "rollup-plugin-polyfill-node": "^0.6.2",
94
91
  "sass": "^1.32.8",
95
92
  "stream-browserify": "^3.0.0",
96
- "typescript": "4.0.6",
93
+ "typescript": "4.5.4",
97
94
  "vite": "2.3.1"
98
95
  },
99
96
  "jest": {
100
97
  "setupFilesAfterEnv": [
101
98
  "./jestsetup.ts"
102
99
  ],
103
- "snapshotSerializers": [
104
- "enzyme-to-json/serializer"
105
- ],
106
100
  "moduleNameMapper": {
107
101
  "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
108
102
  "\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
@@ -121,5 +115,5 @@
121
115
  "publishConfig": {
122
116
  "access": "public"
123
117
  },
124
- "gitHead": "4be2d1b7d3c1f1ebb69d469e9c986b9b5ed4af77"
118
+ "gitHead": "d72d3bbe43716e22497d07621736302c2330749f"
125
119
  }
@@ -1,35 +1,35 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`common/forms/WarnButton renders successfully 1`] = `
4
- <span
5
- className=""
6
- >
7
- <button
8
- className="btn-warn-component warning"
9
- onClick={[Function]}
4
+ <DocumentFragment>
5
+ <span
6
+ class=""
10
7
  >
11
- <i
12
- className="fa fa-trash-o"
13
- />
14
-
15
- A Button!
16
- </button>
17
- </span>
8
+ <button
9
+ class="btn-warn-component warning"
10
+ >
11
+ <i
12
+ class="fa fa-trash-o"
13
+ />
14
+ A Button!
15
+ </button>
16
+ </span>
17
+ </DocumentFragment>
18
18
  `;
19
19
 
20
20
  exports[`common/forms/WarnButton renders with warnings disable 1`] = `
21
- <span
22
- className=""
23
- >
24
- <button
25
- className="btn-warn-component warning"
26
- onClick={[Function]}
21
+ <DocumentFragment>
22
+ <span
23
+ class=""
27
24
  >
28
- <i
29
- className="fa fa-trash-o"
30
- />
31
-
32
- A Button!
33
- </button>
34
- </span>
25
+ <button
26
+ class="btn-warn-component warning"
27
+ >
28
+ <i
29
+ class="fa fa-trash-o"
30
+ />
31
+ A Button!
32
+ </button>
33
+ </span>
34
+ </DocumentFragment>
35
35
  `;
@@ -1,14 +1,16 @@
1
1
  import React from 'react'
2
- import { shallow } from 'enzyme'
2
+ import { render } from '@testing-library/react'
3
3
  import WarnButton from '../warn-button'
4
4
 
5
5
  describe('common/forms/WarnButton', () => {
6
6
  it('renders successfully', () => {
7
- const wrapper = shallow(<WarnButton message="A Button!" />)
8
- expect(wrapper).toMatchSnapshot()
7
+ const { asFragment } = render(<WarnButton message="A Button!" />)
8
+ expect(asFragment()).toMatchSnapshot()
9
9
  })
10
10
  it('renders with warnings disable', () => {
11
- const wrapper = shallow(<WarnButton message="A Button!" warn={false} />)
12
- expect(wrapper).toMatchSnapshot()
11
+ const { asFragment } = render(
12
+ <WarnButton message="A Button!" warn={false} />,
13
+ )
14
+ expect(asFragment()).toMatchSnapshot()
13
15
  })
14
16
  })
@@ -1,161 +1,3 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`FilesSubscription renders with common props 1`] = `
4
- <Subscription
5
- onSubscriptionData={[Function]}
6
- subscription={
7
- Object {
8
- "definitions": Array [
9
- Object {
10
- "directives": Array [],
11
- "kind": "OperationDefinition",
12
- "name": Object {
13
- "kind": "Name",
14
- "value": "filesUpdated",
15
- },
16
- "operation": "subscription",
17
- "selectionSet": Object {
18
- "kind": "SelectionSet",
19
- "selections": Array [
20
- Object {
21
- "alias": undefined,
22
- "arguments": Array [
23
- Object {
24
- "kind": "Argument",
25
- "name": Object {
26
- "kind": "Name",
27
- "value": "datasetId",
28
- },
29
- "value": Object {
30
- "kind": "Variable",
31
- "name": Object {
32
- "kind": "Name",
33
- "value": "datasetId",
34
- },
35
- },
36
- },
37
- ],
38
- "directives": Array [],
39
- "kind": "Field",
40
- "name": Object {
41
- "kind": "Name",
42
- "value": "filesUpdated",
43
- },
44
- "selectionSet": Object {
45
- "kind": "SelectionSet",
46
- "selections": Array [
47
- Object {
48
- "alias": undefined,
49
- "arguments": Array [],
50
- "directives": Array [],
51
- "kind": "Field",
52
- "name": Object {
53
- "kind": "Name",
54
- "value": "action",
55
- },
56
- "selectionSet": undefined,
57
- },
58
- Object {
59
- "alias": undefined,
60
- "arguments": Array [],
61
- "directives": Array [],
62
- "kind": "Field",
63
- "name": Object {
64
- "kind": "Name",
65
- "value": "payload",
66
- },
67
- "selectionSet": Object {
68
- "kind": "SelectionSet",
69
- "selections": Array [
70
- Object {
71
- "alias": undefined,
72
- "arguments": Array [],
73
- "directives": Array [],
74
- "kind": "Field",
75
- "name": Object {
76
- "kind": "Name",
77
- "value": "id",
78
- },
79
- "selectionSet": undefined,
80
- },
81
- Object {
82
- "alias": undefined,
83
- "arguments": Array [],
84
- "directives": Array [],
85
- "kind": "Field",
86
- "name": Object {
87
- "kind": "Name",
88
- "value": "filename",
89
- },
90
- "selectionSet": undefined,
91
- },
92
- Object {
93
- "alias": undefined,
94
- "arguments": Array [],
95
- "directives": Array [],
96
- "kind": "Field",
97
- "name": Object {
98
- "kind": "Name",
99
- "value": "size",
100
- },
101
- "selectionSet": undefined,
102
- },
103
- Object {
104
- "alias": undefined,
105
- "arguments": Array [],
106
- "directives": Array [],
107
- "kind": "Field",
108
- "name": Object {
109
- "kind": "Name",
110
- "value": "directory",
111
- },
112
- "selectionSet": undefined,
113
- },
114
- ],
115
- },
116
- },
117
- ],
118
- },
119
- },
120
- ],
121
- },
122
- "variableDefinitions": Array [
123
- Object {
124
- "defaultValue": undefined,
125
- "directives": Array [],
126
- "kind": "VariableDefinition",
127
- "type": Object {
128
- "kind": "NonNullType",
129
- "type": Object {
130
- "kind": "NamedType",
131
- "name": Object {
132
- "kind": "Name",
133
- "value": "ID",
134
- },
135
- },
136
- },
137
- "variable": Object {
138
- "kind": "Variable",
139
- "name": Object {
140
- "kind": "Name",
141
- "value": "datasetId",
142
- },
143
- },
144
- },
145
- ],
146
- },
147
- ],
148
- "kind": "Document",
149
- "loc": Object {
150
- "end": 196,
151
- "start": 0,
152
- },
153
- }
154
- }
155
- variables={
156
- Object {
157
- "datasetId": "ds001",
158
- }
159
- }
160
- />
161
- `;
3
+ exports[`FilesSubscription renders with common props 1`] = `<DocumentFragment />`;
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
- import { shallow } from 'enzyme'
2
+ import { render } from '@testing-library/react'
3
+ import { MockedProvider } from '@apollo/client/testing'
3
4
  import FilesSubscription, {
4
5
  deleteFilesReducer,
5
6
  updateFilesReducer,
@@ -7,8 +8,10 @@ import FilesSubscription, {
7
8
 
8
9
  describe('FilesSubscription', () => {
9
10
  it('renders with common props', () => {
10
- const wrapper = shallow(<FilesSubscription datasetId="ds001" />)
11
- expect(wrapper).toMatchSnapshot()
11
+ const { asFragment } = render(<FilesSubscription datasetId="ds001" />, {
12
+ wrapper: MockedProvider,
13
+ })
14
+ expect(asFragment()).toMatchSnapshot()
12
15
  })
13
16
  })
14
17
 
@@ -13,29 +13,10 @@ class ErrorRoute extends React.Component {
13
13
  return (
14
14
  <div className="container errors">
15
15
  <div className="panel">
16
- <Route
17
- name="orcidError"
18
- path="/error/orcid"
19
- component={OrcidGeneral}
20
- />
21
- <Route
22
- name="email"
23
- exact
24
- path="/error/orcid/email"
25
- component={OrcidEmail}
26
- />
27
- <Route
28
- name="given"
29
- exact
30
- path="/error/orcid/given"
31
- component={OrcidGiven}
32
- />
33
- <Route
34
- name="family"
35
- exact
36
- path="/error/orcid/family"
37
- component={OrcidFamily}
38
- />
16
+ <Route path="/error/orcid" component={OrcidGeneral} />
17
+ <Route exact path="/error/orcid/email" component={OrcidEmail} />
18
+ <Route exact path="/error/orcid/given" component={OrcidGiven} />
19
+ <Route exact path="/error/orcid/family" component={OrcidFamily} />
39
20
  </div>
40
21
  </div>
41
22
  )