@openneuro/app 4.2.3 → 4.3.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.
Files changed (75) hide show
  1. package/jestsetup.ts +0 -5
  2. package/package.json +8 -13
  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
@@ -1,256 +1,285 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`faq/faq/Faq renders successfully 1`] = `
4
- <Fragment>
5
- <HelmetWrapper
6
- defer={true}
7
- encodeSpecialCharacters={true}
8
- >
9
- <title>
10
- Frequently Asked Questions -
11
- OpenNeuro
12
- </title>
13
- </HelmetWrapper>
4
+ <DocumentFragment>
14
5
  <div
15
- className="container faqs"
6
+ class="container faqs"
16
7
  >
17
8
  <h1>
18
9
  FAQ's
19
10
  </h1>
20
11
  <div
21
- className="panel"
22
- key="0"
12
+ class="panel"
23
13
  >
24
- <Te
25
- className="panel-heading"
26
- options={
27
- Object {
28
- "forceBlock": true,
29
- }
30
- }
14
+ <p
15
+ class="panel-heading"
31
16
  >
32
17
  How do I get started?
33
- </Te>
18
+ </p>
34
19
  <div
35
- className="panel-body"
20
+ class="panel-body"
36
21
  >
37
22
  <span>
38
- <Te>
39
- Check out our [video tutorial](https://www.youtube.com/watch?v=FK_c1x1Pilk).
40
- </Te>
23
+ <span>
24
+ Check out our
25
+ <a
26
+ href="https://www.youtube.com/watch?v=FK_c1x1Pilk"
27
+ >
28
+ video tutorial
29
+ </a>
30
+ .
31
+ </span>
41
32
  </span>
42
33
  </div>
43
34
  </div>
44
35
  <div
45
- className="panel"
46
- key="1"
36
+ class="panel"
47
37
  >
48
- <Te
49
- className="panel-heading"
50
- options={
51
- Object {
52
- "forceBlock": true,
53
- }
54
- }
38
+ <p
39
+ class="panel-heading"
55
40
  >
56
41
  Is this service free to use?
57
- </Te>
42
+ </p>
58
43
  <div
59
- className="panel-body"
44
+ class="panel-body"
60
45
  >
61
46
  <span>
62
- <Te>
47
+ <span>
63
48
  Yes!
64
- </Te>
49
+ </span>
65
50
  </span>
66
51
  </div>
67
52
  </div>
68
53
  <div
69
- className="panel"
70
- key="2"
54
+ class="panel"
71
55
  >
72
- <Te
73
- className="panel-heading"
74
- options={
75
- Object {
76
- "forceBlock": true,
77
- }
78
- }
56
+ <p
57
+ class="panel-heading"
79
58
  >
80
59
  Are there any restrictions on the uploaded data?
81
- </Te>
60
+ </p>
82
61
  <div
83
- className="panel-body"
62
+ class="panel-body"
84
63
  >
85
64
  <span>
86
- <Te>
87
- Yes. By uploading this dataset to OpenNeuro you have to agree to the following conditions:
88
-
89
- * You are the owner of this dataset and have any necessary ethics permissions to share the data publicly.
90
- * This dataset does not include any identifiable personal health information as defined by the Health Insurance Portability and Accountability Act of 1996 (including names, zip codes, dates of birth, acquisition dates, facial features on structural scans, etc.).
91
- * You agree that this dataset will become publicly available under a Creative Commons CC0 license after a grace period of 36 months counted from the first successful snapshot of the dataset.
92
- * This dataset is not subject to GDPR protections.
93
- </Te>
65
+ <div>
66
+ <p>
67
+ Yes. By uploading this dataset to OpenNeuro you have to agree to the following conditions:
68
+ </p>
69
+ <ul>
70
+ <li>
71
+ You are the owner of this dataset and have any necessary ethics permissions to share the data publicly.
72
+ </li>
73
+ <li>
74
+ This dataset does not include any identifiable personal health information as defined by the Health Insurance Portability and Accountability Act of 1996 (including names, zip codes, dates of birth, acquisition dates, facial features on structural scans, etc.).
75
+ </li>
76
+ <li>
77
+ You agree that this dataset will become publicly available under a Creative Commons CC0 license after a grace period of 36 months counted from the first successful snapshot of the dataset.
78
+ </li>
79
+ <li>
80
+ This dataset is not subject to GDPR protections.
81
+ </li>
82
+ </ul>
83
+ </div>
94
84
  </span>
95
85
  </div>
96
86
  </div>
97
87
  <div
98
- className="panel"
99
- key="3"
88
+ class="panel"
100
89
  >
101
- <Te
102
- className="panel-heading"
103
- options={
104
- Object {
105
- "forceBlock": true,
106
- }
107
- }
90
+ <p
91
+ class="panel-heading"
108
92
  >
109
93
  What if I will not be able to publish my paper in 36 months?
110
- </Te>
94
+ </p>
111
95
  <div
112
- className="panel-body"
96
+ class="panel-body"
113
97
  >
114
98
  <span>
115
- <Te>
99
+ <span>
116
100
  You can apply for up to two 6-month long extensions of the grace period. To apply please contact support. We encourage you to publish a preprint of your work to reduce the uncertainty of the publishing pipeline.
117
- </Te>
101
+ </span>
118
102
  </span>
119
103
  </div>
120
104
  </div>
121
105
  <div
122
- className="panel"
123
- key="4"
106
+ class="panel"
124
107
  >
125
- <Te
126
- className="panel-heading"
127
- options={
128
- Object {
129
- "forceBlock": true,
130
- }
131
- }
108
+ <p
109
+ class="panel-heading"
132
110
  >
133
111
  Are there consent form templates we can use in our study?
134
- </Te>
112
+ </p>
135
113
  <div
136
- className="panel-body"
114
+ class="panel-body"
137
115
  >
138
116
  <span>
139
- <Te>
140
- Yes! We recommend using the Open Brain Consent - [Ultimate consent form](https://open-brain-consent.readthedocs.io/en/stable/ultimate.html).
141
-
142
- * For GDPR protected studies, they have a [Ultimate consent form GDPR edition](https://open-brain-consent.readthedocs.io/en/stable/gdpr/ultimate_gdpr.html).
143
- </Te>
117
+ <div>
118
+ <p>
119
+ Yes! We recommend using the Open Brain Consent -
120
+ <a
121
+ href="https://open-brain-consent.readthedocs.io/en/stable/ultimate.html"
122
+ >
123
+ Ultimate consent form
124
+ </a>
125
+ .
126
+ </p>
127
+ <ul>
128
+ <li>
129
+ For GDPR protected studies, they have a
130
+ <a
131
+ href="https://open-brain-consent.readthedocs.io/en/stable/gdpr/ultimate_gdpr.html"
132
+ >
133
+ Ultimate consent form GDPR edition
134
+ </a>
135
+ .
136
+ </li>
137
+ </ul>
138
+ </div>
144
139
  </span>
145
140
  </div>
146
141
  </div>
147
142
  <div
148
- className="panel"
149
- key="5"
143
+ class="panel"
150
144
  >
151
- <Te
152
- className="panel-heading"
153
- options={
154
- Object {
155
- "forceBlock": true,
156
- }
157
- }
145
+ <p
146
+ class="panel-heading"
158
147
  >
159
148
  Do I need to format my data in some special way before uploading it to OpenNeuro?
160
- </Te>
149
+ </p>
161
150
  <div
162
- className="panel-body"
151
+ class="panel-body"
163
152
  >
164
153
  <span>
165
- <Te>
166
- Yes! OpenNeuro only accepts data in the Brain Imaging Data Structure (BIDS) format. You can read about it more at [bids.neuroimaging.io](http://bids.neuroimaging.io/). If you have any questions about organizing your data please post them at [neurostars.org](https://neurostars.org/tags/bids).
167
- </Te>
154
+ <span>
155
+ Yes! OpenNeuro only accepts data in the Brain Imaging Data Structure (BIDS) format. You can read about it more at
156
+ <a
157
+ href="http://bids.neuroimaging.io/"
158
+ >
159
+ bids.neuroimaging.io
160
+ </a>
161
+ . If you have any questions about organizing your data please post them at
162
+ <a
163
+ href="https://neurostars.org/tags/bids"
164
+ >
165
+ neurostars.org
166
+ </a>
167
+ .
168
+ </span>
168
169
  </span>
169
170
  </div>
170
171
  </div>
171
172
  <div
172
- className="panel"
173
- key="6"
173
+ class="panel"
174
174
  >
175
- <Te
176
- className="panel-heading"
177
- options={
178
- Object {
179
- "forceBlock": true,
180
- }
181
- }
175
+ <p
176
+ class="panel-heading"
182
177
  >
183
178
  Do I need to remove facial features from structural images before uploading the data?
184
- </Te>
179
+ </p>
185
180
  <div
186
- className="panel-body"
181
+ class="panel-body"
187
182
  >
188
183
  <span>
189
- <Te>
190
- OpenNeuro does not accept datasets that have not been defaced for privacy considerations. Datasets found to not have been defaced will be deleted and the dataset owner is invited to reupload their dataset with the defaced images. The dataset owner will be notified by the OpenNeuro team if an infringement has been detected. The only exception is explicit approval from the study participant(s).
191
-
192
- We recommend using [pydeface](https://pypi.python.org/pypi/pydeface) to deface your images. In the case that the dataset(s) is cited in publications, please notify the OpenNeuro team and we will direct the DOI and dataset links from the previous dataset to the new dataset. We suggest adding a note to the README of the reuploaded dataset to specify this change.
193
-
194
- For any questions or concerns please email Franklin: &lt;ffein@stanford.edu&gt;
195
- </Te>
184
+ <div>
185
+ <p>
186
+ OpenNeuro does not accept datasets that have not been defaced for privacy considerations. Datasets found to not have been defaced will be deleted and the dataset owner is invited to reupload their dataset with the defaced images. The dataset owner will be notified by the OpenNeuro team if an infringement has been detected. The only exception is explicit approval from the study participant(s).
187
+ </p>
188
+ <p>
189
+ We recommend using
190
+ <a
191
+ href="https://pypi.python.org/pypi/pydeface"
192
+ >
193
+ pydeface
194
+ </a>
195
+ to deface your images. In the case that the dataset(s) is cited in publications, please notify the OpenNeuro team and we will direct the DOI and dataset links from the previous dataset to the new dataset. We suggest adding a note to the README of the reuploaded dataset to specify this change.
196
+ </p>
197
+ <p>
198
+ For any questions or concerns please email Franklin:
199
+ <a
200
+ href="mailto:ffein@stanford.edu"
201
+ >
202
+ ffein@stanford.edu
203
+ </a>
204
+ </p>
205
+ </div>
196
206
  </span>
197
207
  </div>
198
208
  </div>
199
209
  <div
200
- className="panel"
201
- key="7"
210
+ class="panel"
202
211
  >
203
- <Te
204
- className="panel-heading"
205
- options={
206
- Object {
207
- "forceBlock": true,
208
- }
209
- }
212
+ <p
213
+ class="panel-heading"
210
214
  >
211
215
  How can I upload data onto OpenNeuro?
212
- </Te>
216
+ </p>
213
217
  <div
214
- className="panel-body"
218
+ class="panel-body"
215
219
  >
216
220
  <span>
217
- <Te>
218
- We offer two options for uploading data onto OpenNeuro. The first is to upload via the web interface. The second is to upload via our [command-line utility tool](https://docs.openneuro.org/packages-openneuro-cli-readme)
219
- </Te>
221
+ <span>
222
+ We offer two options for uploading data onto OpenNeuro. The first is to upload via the web interface. The second is to upload via our
223
+ <a
224
+ href="https://docs.openneuro.org/packages-openneuro-cli-readme"
225
+ >
226
+ command-line utility tool
227
+ </a>
228
+ </span>
220
229
  </span>
221
230
  </div>
222
231
  </div>
223
232
  <div
224
- className="panel"
225
- key="8"
233
+ class="panel"
226
234
  >
227
- <Te
228
- className="panel-heading"
229
- options={
230
- Object {
231
- "forceBlock": true,
232
- }
233
- }
235
+ <p
236
+ class="panel-heading"
234
237
  >
235
238
  Why can I not use CC-BY (or other CC license)?
236
- </Te>
239
+ </p>
237
240
  <div
238
- className="panel-body"
241
+ class="panel-body"
239
242
  >
240
243
  <span>
241
- <Te>
242
- When OpenNeuro first began accepting data, we hosted datasets that were dedicated to the public domain (CC0 or PDDL) or released under the CC-BY license. The idea of accepting CC-BY licenses was to reflect the academic norm of citing sources, but it fails to achieve that goal. In [CC BY and data: Not always a good fit](https://osc.universityofcalifornia.edu/2016/09/cc-by-and-data-not-always-a-good-fit/), it is argued:
243
-
244
- &gt; **CC licenses are not sufficient for ensuring proper attribution in many cases because their restrictions — including attribution — do not apply to facts.**
245
- &gt; ...
246
-
247
- &gt; **CC licenses' attribution requirements aren't necessary because scholars have very good reasons to provide attribution that has nothing to do with copyright** [...] Data that comes from nowhere has little credibility. If someone wants to use data as persuasive evidence, they need to refer readers and reviewers back to its source: who it came from and how it was produced.
248
-
249
- CC-BY places an ambiguous legal hurdle between researchers and data they are considering using, even if only intended to enforce standard academic practice. To reduce uncertainty for data consumers, all newly published datasets are released under CC0, as are new versions of previously released datasets. We do nonetheless want to encourage proper attribution of datasets hosted on OpenNeuro. Each version of a dataset is assigned a unique DOI, enabling researchers to cite the version of a dataset they analyzed. Additionally, all OpenNeuro datasets may include a ["HowToAcknowledge" field](https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#dataset_descriptionjson), in which dataset providers may provide specific instructions for users for what they consider an appropriate citation.
250
- </Te>
244
+ <div>
245
+ <p>
246
+ When OpenNeuro first began accepting data, we hosted datasets that were dedicated to the public domain (CC0 or PDDL) or released under the CC-BY license. The idea of accepting CC-BY licenses was to reflect the academic norm of citing sources, but it fails to achieve that goal. In
247
+ <a
248
+ href="https://osc.universityofcalifornia.edu/2016/09/cc-by-and-data-not-always-a-good-fit/"
249
+ >
250
+ CC BY and data: Not always a good fit
251
+ </a>
252
+ , it is argued:
253
+ </p>
254
+ <blockquote>
255
+ <p>
256
+
257
+ <strong>
258
+ CC licenses are not sufficient for ensuring proper attribution in many cases because their restrictions — including attribution — do not apply to facts.
259
+ </strong>
260
+
261
+ ...
262
+ </p>
263
+ <p>
264
+ <strong>
265
+ CC licenses' attribution requirements aren't necessary because scholars have very good reasons to provide attribution that has nothing to do with copyright
266
+ </strong>
267
+ [...] Data that comes from nowhere has little credibility. If someone wants to use data as persuasive evidence, they need to refer readers and reviewers back to its source: who it came from and how it was produced.
268
+ </p>
269
+ </blockquote>
270
+ <p>
271
+ CC-BY places an ambiguous legal hurdle between researchers and data they are considering using, even if only intended to enforce standard academic practice. To reduce uncertainty for data consumers, all newly published datasets are released under CC0, as are new versions of previously released datasets. We do nonetheless want to encourage proper attribution of datasets hosted on OpenNeuro. Each version of a dataset is assigned a unique DOI, enabling researchers to cite the version of a dataset they analyzed. Additionally, all OpenNeuro datasets may include a
272
+ <a
273
+ href="https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#dataset_descriptionjson"
274
+ >
275
+ "HowToAcknowledge" field
276
+ </a>
277
+ , in which dataset providers may provide specific instructions for users for what they consider an appropriate citation.
278
+ </p>
279
+ </div>
251
280
  </span>
252
281
  </div>
253
282
  </div>
254
283
  </div>
255
- </Fragment>
284
+ </DocumentFragment>
256
285
  `;
@@ -1,10 +1,10 @@
1
1
  import React from 'react'
2
- import { shallow } from 'enzyme'
2
+ import { render } from '@testing-library/react'
3
3
  import Faq from '../faq'
4
4
 
5
5
  describe('faq/faq/Faq', () => {
6
6
  it('renders successfully', () => {
7
- const wrapper = shallow(<Faq />)
8
- expect(wrapper).toMatchSnapshot()
7
+ const { asFragment } = render(<Faq />)
8
+ expect(asFragment()).toMatchSnapshot()
9
9
  })
10
10
  })
@@ -29,14 +29,8 @@ class Dashboard extends React.Component {
29
29
  </ul>
30
30
  <Switch>
31
31
  <Redirect path="/admin" to="/admin/users" exact />
32
+ <Route path="/admin/users" exact component={Users} />
32
33
  <Route
33
- name="users"
34
- path="/admin/users"
35
- exact
36
- component={Users}
37
- />
38
- <Route
39
- name="flaggedFiles"
40
34
  path="/admin/flagged-files"
41
35
  exact
42
36
  component={FlaggedFiles}
@@ -1,129 +1,31 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`Comments component recursively renders a tree of comments 1`] = `
4
- <Comments
5
- comments={
6
- Array [
7
- Object {
8
- "id": "xyz",
9
- "replies": Array [
10
- Object {
11
- "id": "xyz",
12
- "replies": Array [],
13
- "text": "{\\"blocks\\":[{\\"key\\":\\"3sm42\\",\\"text\\":\\"\\",\\"type\\":\\"unstyled\\",\\"depth\\":0,\\"inlineStyleRanges\\":[],\\"entityRanges\\":[],\\"data\\":{}}],\\"entityMap\\":{}}",
14
- "user": Object {
15
- "email": "example@example.com",
16
- "id": "1234",
17
- },
18
- },
19
- ],
20
- "text": "{\\"blocks\\":[{\\"key\\":\\"3sm42\\",\\"text\\":\\"\\",\\"type\\":\\"unstyled\\",\\"depth\\":0,\\"inlineStyleRanges\\":[],\\"entityRanges\\":[],\\"data\\":{}}],\\"entityMap\\":{}}",
21
- "user": Object {
22
- "email": "example@example.com",
23
- "id": "1234",
24
- },
25
- },
26
- ]
27
- }
28
- datasetId="ds000001"
29
- >
4
+ <DocumentFragment>
30
5
  <div
31
- className="dataset-comments"
6
+ class="dataset-comments"
32
7
  >
33
8
  <h2>
34
9
  Comments
35
10
  </h2>
36
- <ErrorBoundary
37
- subject="error in dataset comments"
38
- >
39
- <LoggedIn />
40
- <LoggedOut>
41
- <div>
42
- Please sign in to contribute to the discussion.
43
- </div>
44
- </LoggedOut>
45
- <CommentTree
46
- commentMap={
47
- Object {
48
- "xyz": Object {
49
- "id": "xyz",
50
- "replies": Array [
51
- Object {
52
- "id": "xyz",
53
- "replies": Array [],
54
- "text": "{\\"blocks\\":[{\\"key\\":\\"3sm42\\",\\"text\\":\\"\\",\\"type\\":\\"unstyled\\",\\"depth\\":0,\\"inlineStyleRanges\\":[],\\"entityRanges\\":[],\\"data\\":{}}],\\"entityMap\\":{}}",
55
- "user": Object {
56
- "email": "example@example.com",
57
- "id": "1234",
58
- },
59
- },
60
- ],
61
- "text": "{\\"blocks\\":[{\\"key\\":\\"3sm42\\",\\"text\\":\\"\\",\\"type\\":\\"unstyled\\",\\"depth\\":0,\\"inlineStyleRanges\\":[],\\"entityRanges\\":[],\\"data\\":{}}],\\"entityMap\\":{}}",
62
- "user": Object {
63
- "email": "example@example.com",
64
- "id": "1234",
65
- },
66
- },
67
- }
68
- }
69
- comments={Array []}
70
- datasetId="ds000001"
71
- />
72
- </ErrorBoundary>
11
+ <div>
12
+ Please sign in to contribute to the discussion.
13
+ </div>
73
14
  </div>
74
- </Comments>
15
+ </DocumentFragment>
75
16
  `;
76
17
 
77
18
  exports[`Comments component renders one top level comment 1`] = `
78
- <Comments
79
- comments={
80
- Array [
81
- Object {
82
- "id": "xyz",
83
- "replies": Array [],
84
- "text": "{\\"blocks\\":[{\\"key\\":\\"3sm42\\",\\"text\\":\\"\\",\\"type\\":\\"unstyled\\",\\"depth\\":0,\\"inlineStyleRanges\\":[],\\"entityRanges\\":[],\\"data\\":{}}],\\"entityMap\\":{}}",
85
- "user": Object {
86
- "email": "example@example.com",
87
- "id": "1234",
88
- },
89
- },
90
- ]
91
- }
92
- datasetId="ds000001"
93
- >
19
+ <DocumentFragment>
94
20
  <div
95
- className="dataset-comments"
21
+ class="dataset-comments"
96
22
  >
97
23
  <h2>
98
24
  Comments
99
25
  </h2>
100
- <ErrorBoundary
101
- subject="error in dataset comments"
102
- >
103
- <LoggedIn />
104
- <LoggedOut>
105
- <div>
106
- Please sign in to contribute to the discussion.
107
- </div>
108
- </LoggedOut>
109
- <CommentTree
110
- commentMap={
111
- Object {
112
- "xyz": Object {
113
- "id": "xyz",
114
- "replies": Array [],
115
- "text": "{\\"blocks\\":[{\\"key\\":\\"3sm42\\",\\"text\\":\\"\\",\\"type\\":\\"unstyled\\",\\"depth\\":0,\\"inlineStyleRanges\\":[],\\"entityRanges\\":[],\\"data\\":{}}],\\"entityMap\\":{}}",
116
- "user": Object {
117
- "email": "example@example.com",
118
- "id": "1234",
119
- },
120
- },
121
- }
122
- }
123
- comments={Array []}
124
- datasetId="ds000001"
125
- />
126
- </ErrorBoundary>
26
+ <div>
27
+ Please sign in to contribute to the discussion.
28
+ </div>
127
29
  </div>
128
- </Comments>
30
+ </DocumentFragment>
129
31
  `;
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { mount } from 'enzyme'
2
+ import { render } from '@testing-library/react'
3
3
  import Comments from '../comments.jsx'
4
4
 
5
5
  const emptyState =
@@ -13,14 +13,16 @@ const exampleComment = {
13
13
 
14
14
  describe('Comments component', () => {
15
15
  it('renders one top level comment', () => {
16
- const wrapper = mount(
16
+ const { asFragment } = render(
17
17
  <Comments datasetId="ds000001" comments={[exampleComment]} />,
18
18
  )
19
- expect(wrapper).toMatchSnapshot()
19
+ expect(asFragment()).toMatchSnapshot()
20
20
  })
21
21
  it('recursively renders a tree of comments', () => {
22
22
  const comments = [{ ...exampleComment, replies: [exampleComment] }]
23
- const wrapper = mount(<Comments datasetId="ds000001" comments={comments} />)
24
- expect(wrapper).toMatchSnapshot()
23
+ const { asFragment } = render(
24
+ <Comments datasetId="ds000001" comments={comments} />,
25
+ )
26
+ expect(asFragment()).toMatchSnapshot()
25
27
  })
26
28
  })
@@ -172,8 +172,7 @@ export const DatasetQueryHook = ({ datasetId, draft, history }) => {
172
172
  datasetId,
173
173
  fetchMore,
174
174
  error,
175
- }}
176
- >
175
+ }}>
177
176
  <DatasetRoutes dataset={data.dataset} />
178
177
  <FilesSubscription datasetId={datasetId} />
179
178
  </DatasetQueryContext.Provider>
@@ -208,8 +207,7 @@ const DatasetQuery = ({ match, history }) => {
208
207
  <>
209
208
  <DatasetRedirect />
210
209
  <ErrorBoundaryAssertionFailureException
211
- subject={'error in dataset query'}
212
- >
210
+ subject={'error in dataset query'}>
213
211
  <DatasetQueryHook
214
212
  datasetId={datasetId}
215
213
  draft={!snapshotId}