@openneuro/app 4.2.4 → 4.3.0-alpha.1

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 (75) hide show
  1. package/jestsetup.ts +0 -5
  2. package/package.json +7 -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/dataset/dataset-query-fragments.js +6 -0
  6. package/src/scripts/datalad/subscriptions/__tests__/__snapshots__/files-subscription.spec.jsx.snap +1 -159
  7. package/src/scripts/datalad/subscriptions/__tests__/files-subscription.spec.jsx +6 -3
  8. package/src/scripts/errors/errorRoute.jsx +4 -23
  9. package/src/scripts/faq/__tests__/__snapshots__/faq.spec.jsx.snap +183 -154
  10. package/src/scripts/faq/__tests__/faq.spec.jsx +3 -3
  11. package/src/scripts/refactor_2021/admin/admin.jsx +1 -7
  12. package/src/scripts/refactor_2021/dataset/comments/__tests__/__snapshots__/comments.spec.jsx.snap +12 -110
  13. package/src/scripts/refactor_2021/dataset/comments/__tests__/comments.spec.jsx +7 -5
  14. package/src/scripts/refactor_2021/dataset/dataset-query.jsx +2 -4
  15. package/src/scripts/refactor_2021/dataset/dataset-routes.jsx +6 -11
  16. package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/download-command-line.spec.jsx.snap +8 -9
  17. package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/download-link.spec.jsx.snap +46 -1255
  18. package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/shell-example.spec.jsx.snap +3 -4
  19. package/src/scripts/refactor_2021/dataset/download/__tests__/download-command-line.spec.jsx +10 -11
  20. package/src/scripts/refactor_2021/dataset/download/__tests__/download-link.spec.jsx +3 -3
  21. package/src/scripts/refactor_2021/dataset/download/__tests__/shell-example.spec.jsx +3 -3
  22. package/src/scripts/refactor_2021/dataset/download/download-command-line.jsx +1 -1
  23. package/src/scripts/refactor_2021/dataset/draft-container.tsx +6 -23
  24. package/src/scripts/refactor_2021/dataset/draft-snapshot-routes.tsx +1 -6
  25. package/src/scripts/refactor_2021/dataset/files/__tests__/__snapshots__/file-tree.spec.jsx.snap +24 -49
  26. package/src/scripts/refactor_2021/dataset/files/__tests__/__snapshots__/file.spec.jsx.snap +74 -54
  27. package/src/scripts/refactor_2021/dataset/files/__tests__/file-tree-unloaded-directory.spec.jsx +4 -3
  28. package/src/scripts/refactor_2021/dataset/files/__tests__/file-tree.spec.jsx +23 -19
  29. package/src/scripts/refactor_2021/dataset/files/__tests__/file-viewer-type.spec.jsx +5 -3
  30. package/src/scripts/refactor_2021/dataset/files/__tests__/file.spec.jsx +21 -21
  31. package/src/scripts/refactor_2021/dataset/files/file.jsx +3 -2
  32. package/src/scripts/refactor_2021/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +85 -60
  33. package/src/scripts/refactor_2021/dataset/files/viewers/__tests__/file-viewer-json.spec.jsx +5 -5
  34. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/cancel-button.spec.tsx.snap +14 -6
  35. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/edit-button.spec.tsx.snap +14 -6
  36. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/save-button.spec.tsx.snap +14 -6
  37. package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/select-input.spec.tsx.snap +178 -105
  38. package/src/scripts/refactor_2021/dataset/fragments/__tests__/cancel-button.spec.tsx +3 -3
  39. package/src/scripts/refactor_2021/dataset/fragments/__tests__/dataset-alert-draft.spec.tsx +72 -0
  40. package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-button.spec.tsx +3 -3
  41. package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-list.spec.jsx +0 -1
  42. package/src/scripts/refactor_2021/dataset/fragments/__tests__/save-button.spec.tsx +3 -3
  43. package/src/scripts/refactor_2021/dataset/fragments/__tests__/select-input.spec.tsx +9 -9
  44. package/src/scripts/refactor_2021/dataset/fragments/dataset-alert-draft.tsx +79 -0
  45. package/src/scripts/refactor_2021/dataset/fragments/dataset-alert-version.tsx +24 -0
  46. package/src/scripts/refactor_2021/dataset/fragments/select-input.tsx +1 -1
  47. package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/deprecate-snapshot.spec.tsx.snap +14 -0
  48. package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/deprecate-version.spec.tsx.snap +14 -0
  49. package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/description.spec.jsx.snap +3 -277
  50. package/src/scripts/refactor_2021/dataset/mutations/__tests__/deprecate-snapshot.spec.tsx +71 -0
  51. package/src/scripts/refactor_2021/dataset/mutations/__tests__/deprecate-version.spec.tsx +71 -0
  52. package/src/scripts/refactor_2021/dataset/mutations/__tests__/description.spec.jsx +22 -9
  53. package/src/scripts/refactor_2021/dataset/mutations/deprecate-version.tsx +46 -0
  54. package/src/scripts/refactor_2021/dataset/mutations/description.jsx +1 -1
  55. package/src/scripts/refactor_2021/dataset/mutations/readme.jsx +1 -1
  56. package/src/scripts/refactor_2021/dataset/mutations/submit-metadata.jsx +1 -1
  57. package/src/scripts/refactor_2021/dataset/mutations/undo-deprecate-version.tsx +43 -0
  58. package/src/scripts/refactor_2021/dataset/mutations/update-file.jsx +15 -19
  59. package/src/scripts/refactor_2021/dataset/routes/__tests__/__snapshots__/publish.spec.jsx.snap +3 -0
  60. package/src/scripts/refactor_2021/dataset/routes/__tests__/publish.spec.jsx +13 -0
  61. package/src/scripts/refactor_2021/dataset/routes/add-metadata.jsx +0 -1
  62. package/src/scripts/refactor_2021/dataset/routes/deprecate-snapshot-page.tsx +46 -0
  63. package/src/scripts/refactor_2021/dataset/snapshot-container.tsx +19 -23
  64. package/src/scripts/refactor_2021/routes.tsx +9 -9
  65. package/src/scripts/refactor_2021/uploader/uploader-setup-routes.jsx +4 -24
  66. package/src/scripts/refactor_2021/uploader/uploader-status-routes.jsx +1 -6
  67. package/src/scripts/common/forms/__tests__/__snapshots__/input.spec.jsx.snap +0 -13
  68. package/src/scripts/common/forms/__tests__/input.spec.jsx +0 -25
  69. package/src/scripts/common/forms/input.jsx +0 -98
  70. package/src/scripts/datalad/routes/__tests__/__snapshots__/publish.spec.jsx.snap +0 -14
  71. package/src/scripts/datalad/routes/__tests__/publish.spec.jsx +0 -10
  72. package/src/scripts/datalad/routes/mobile-class.tsx +0 -16
  73. package/src/scripts/datalad/routes/publish.jsx +0 -50
  74. package/src/scripts/refactor_2021/dataset/dataset-query-fragments.js +0 -220
  75. package/src/scripts/refactor_2021/dataset/queries/dataset-query-fragments.js +0 -220
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.3.0-alpha.1",
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.3.0-alpha.1",
23
+ "@openneuro/components": "^4.3.0-alpha.1",
24
24
  "babel-runtime": "^6.26.0",
25
25
  "bids-validator": "1.8.8",
26
26
  "bytes": "^3.0.0",
@@ -30,9 +30,9 @@
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",
35
+ "history": "5.2.0",
36
36
  "jwt-decode": "^2.2.0",
37
37
  "markdown-to-jsx": "^7.1.2",
38
38
  "os-browserify": "^0.3.0",
@@ -76,15 +76,13 @@
76
76
  "@testing-library/react": "^11.1.0",
77
77
  "@types/jest": "^26.0.22",
78
78
  "@types/jsdom": "^16",
79
- "@types/node": "^14.14.37",
79
+ "@types/node": "16.11.13",
80
80
  "@types/react": "^17.0.8",
81
81
  "@types/react-dom": "^17.0.5",
82
82
  "@types/react-router-dom": "5.1.8",
83
83
  "@types/testing-library__jest-dom": "^5.14.0",
84
- "@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
85
84
  "babel-core": "^7.0.0-bridge.0",
86
85
  "babel-jest": "^24.9.0",
87
- "enzyme": "3.9.0",
88
86
  "esbuild-plugin-globals": "^0.1.1",
89
87
  "jest": "^26.6.3",
90
88
  "jest-fetch-mock": "^1.4.1",
@@ -93,16 +91,13 @@
93
91
  "rollup-plugin-polyfill-node": "^0.6.2",
94
92
  "sass": "^1.32.8",
95
93
  "stream-browserify": "^3.0.0",
96
- "typescript": "4.0.6",
94
+ "typescript": "4.5.4",
97
95
  "vite": "2.3.1"
98
96
  },
99
97
  "jest": {
100
98
  "setupFilesAfterEnv": [
101
99
  "./jestsetup.ts"
102
100
  ],
103
- "snapshotSerializers": [
104
- "enzyme-to-json/serializer"
105
- ],
106
101
  "moduleNameMapper": {
107
102
  "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
108
103
  "\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
@@ -121,5 +116,5 @@
121
116
  "publishConfig": {
122
117
  "access": "public"
123
118
  },
124
- "gitHead": "4be2d1b7d3c1f1ebb69d469e9c986b9b5ed4af77"
119
+ "gitHead": "7bddf78a87c14fc36561344bf7170ee01582aa4e"
125
120
  }
@@ -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
  })
@@ -136,6 +136,12 @@ export const SNAPSHOT_FIELDS = gql`
136
136
  tag
137
137
  created
138
138
  readme
139
+ deprecated {
140
+ id
141
+ user
142
+ reason
143
+ timestamp
144
+ }
139
145
  description {
140
146
  Name
141
147
  Authors
@@ -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
  )