@openneuro/app 4.8.0 → 4.9.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.
@@ -0,0 +1,300 @@
1
+ // Example queries responses for use in tests
2
+ export const dataset = {
3
+ id: 'ds001032',
4
+ created: '2021-12-17T22:24:05.500Z',
5
+ public: true,
6
+ following: true,
7
+ followers: [
8
+ {
9
+ userId: '18492691-707f-4161-bc73-6ed22ce40138',
10
+ __typename: 'Follower',
11
+ },
12
+ ],
13
+ starred: false,
14
+ stars: [],
15
+ worker: 'datalad-0',
16
+ draft: {
17
+ id: 'ds001032',
18
+ modified: '2021-12-17T22:32:35.282Z',
19
+ readme:
20
+ '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',
21
+ head: 'd62fdc42e2a568a6f89e33d68d3ef343ff883e02',
22
+ size: 623389,
23
+ description: {
24
+ Name: 'DS003-downsampled (only T1)',
25
+ Authors: ['J. Doe', 'J. Doe', 'J. Doe'],
26
+ DatasetDOI: null,
27
+ License: 'CC0',
28
+ Acknowledgements: null,
29
+ HowToAcknowledge: null,
30
+ Funding: null,
31
+ ReferencesAndLinks: null,
32
+ EthicsApprovals: null,
33
+ __typename: 'Description',
34
+ },
35
+ summary: {
36
+ modalities: ['MRI'],
37
+ secondaryModalities: ['MRI_Structural'],
38
+ sessions: [],
39
+ subjects: ['01', '02'],
40
+ subjectMetadata: [
41
+ {
42
+ participantId: '01',
43
+ age: 25,
44
+ sex: 'M',
45
+ group: null,
46
+ __typename: 'SubjectMetadata',
47
+ },
48
+ ],
49
+ tasks: [],
50
+ size: 623389,
51
+ totalFiles: 7,
52
+ dataProcessed: false,
53
+ pet: null,
54
+ __typename: 'Summary',
55
+ },
56
+ __typename: 'Draft',
57
+ issues: [
58
+ {
59
+ severity: 'warning',
60
+ code: 82,
61
+ reason:
62
+ 'Tabular file contains custom columns not described in a data dictionary',
63
+ files: [
64
+ {
65
+ evidence:
66
+ 'Columns: sex, age not defined, please define in: /participants.json',
67
+ line: null,
68
+ character: null,
69
+ reason:
70
+ 'Tabular file contains custom columns not described in a data dictionary',
71
+ file: {
72
+ name: 'participants.tsv',
73
+ path: '/datalad/ds001032/participants.tsv',
74
+ relativePath: '/participants.tsv',
75
+ __typename: 'ValidationIssueFileDetail',
76
+ },
77
+ __typename: 'ValidationIssueFile',
78
+ },
79
+ ],
80
+ additionalFileCount: 0,
81
+ __typename: 'ValidationIssue',
82
+ },
83
+ ],
84
+ },
85
+ __typename: 'Dataset',
86
+ permissions: {
87
+ id: 'ds001032',
88
+ userPermissions: [
89
+ {
90
+ user: {
91
+ id: '18492691-707f-4161-bc73-6ed22ce40138',
92
+ email: 'test@example.com',
93
+ __typename: 'User',
94
+ },
95
+ level: 'admin',
96
+ __typename: 'Permission',
97
+ },
98
+ ],
99
+ __typename: 'DatasetPermissions',
100
+ },
101
+ snapshots: [
102
+ {
103
+ id: 'ds001032:1.0.0',
104
+ tag: '1.0.0',
105
+ created: '2021-12-17T22:22:49.000Z',
106
+ hexsha: 'e4daf5567b86426b13e2d319859164e410975056',
107
+ __typename: 'Snapshot',
108
+ },
109
+ {
110
+ id: 'ds001032:2.0.0',
111
+ tag: '2.0.0',
112
+ created: '2021-12-17T22:32:08.000Z',
113
+ hexsha: 'd62fdc42e2a568a6f89e33d68d3ef343ff883e02',
114
+ __typename: 'Snapshot',
115
+ },
116
+ ],
117
+ metadata: {
118
+ datasetId: 'ds001032',
119
+ datasetUrl: null,
120
+ datasetName: null,
121
+ firstSnapshotCreatedAt: null,
122
+ latestSnapshotCreatedAt: null,
123
+ dxStatus: '',
124
+ tasksCompleted: [],
125
+ trialCount: null,
126
+ grantFunderName: '',
127
+ grantIdentifier: '',
128
+ studyDesign: '',
129
+ studyDomain: '',
130
+ studyLongitudinal: '',
131
+ dataProcessed: null,
132
+ species: '',
133
+ associatedPaperDOI: '',
134
+ openneuroPaperDOI: '',
135
+ seniorAuthor: null,
136
+ adminUsers: [],
137
+ ages: [],
138
+ modalities: [],
139
+ affirmedDefaced: true,
140
+ affirmedConsent: false,
141
+ __typename: 'Metadata',
142
+ },
143
+ comments: [],
144
+ uploader: {
145
+ id: '18492691-707f-4161-bc73-6ed22ce40138',
146
+ name: 'Test User',
147
+ email: 'test@example.com',
148
+ __typename: 'User',
149
+ },
150
+ analytics: {
151
+ downloads: 0,
152
+ views: 23,
153
+ __typename: 'Analytic',
154
+ },
155
+ derivatives: [],
156
+ onBrainlife: false,
157
+ }
158
+
159
+ export const snapshot = {
160
+ id: 'ds001032:1.0.0',
161
+ tag: '1.0.0',
162
+ created: '2021-12-17T22:32:08.000Z',
163
+ readme:
164
+ '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',
165
+ size: 623389,
166
+ deprecated: null,
167
+ description: {
168
+ Name: 'DS003-downsampled (only T1)',
169
+ Authors: ['J. Doe', 'J. Doe', 'J. Doe'],
170
+ DatasetDOI: null,
171
+ License: 'CC0',
172
+ Acknowledgements: null,
173
+ HowToAcknowledge: null,
174
+ Funding: null,
175
+ ReferencesAndLinks: null,
176
+ EthicsApprovals: null,
177
+ __typename: 'Description',
178
+ },
179
+ files: [
180
+ {
181
+ id: '7dcbfd4d8ef17174c6eb2cc023f7950c682563a5',
182
+ key: '4feabfe8803db741e9a0c5ad00bc3ada109558e3',
183
+ filename: 'CHANGES',
184
+ size: 52,
185
+ directory: null,
186
+ annexed: false,
187
+ __typename: 'DatasetFile',
188
+ },
189
+ {
190
+ id: '63888a199a5ce37377b1cd708cda59577dad218f',
191
+ key: 'fa84e5f958ec72d42b3e196e592f6db9f7104b19',
192
+ filename: 'README',
193
+ size: 709,
194
+ directory: null,
195
+ annexed: false,
196
+ __typename: 'DatasetFile',
197
+ },
198
+ {
199
+ id: '0a2a5d8d72a31f03608db59c4cfd650aba77c363',
200
+ key: 'b08aa0ec5b5e716479824859524a22140fb2af82',
201
+ filename: 'T1w.json',
202
+ size: 196,
203
+ directory: null,
204
+ annexed: false,
205
+ __typename: 'DatasetFile',
206
+ },
207
+ {
208
+ id: 'a2922b427c5c997e77ce058e0ce57ffd17123a7f',
209
+ key: '0b1856b91c11f67098ce60114417a62dd55730a5',
210
+ filename: 'dataset_description.json',
211
+ size: 172,
212
+ directory: null,
213
+ annexed: false,
214
+ __typename: 'DatasetFile',
215
+ },
216
+ {
217
+ id: 'f682a32c9538082fa6c8ad11e9a536dc07d1d0cf',
218
+ key: '37ecbdc7ab8ffaf2cddecc338092f6679089287d',
219
+ filename: 'participants.tsv',
220
+ size: 36,
221
+ directory: null,
222
+ annexed: false,
223
+ __typename: 'DatasetFile',
224
+ },
225
+ {
226
+ id: 'directory:sub-01',
227
+ key: null,
228
+ filename: 'sub-01',
229
+ size: 1,
230
+ directory: true,
231
+ annexed: null,
232
+ __typename: 'DatasetFile',
233
+ },
234
+ {
235
+ id: 'directory:sub-02',
236
+ key: null,
237
+ filename: 'sub-02',
238
+ size: 1,
239
+ directory: true,
240
+ annexed: null,
241
+ __typename: 'DatasetFile',
242
+ },
243
+ ],
244
+ summary: {
245
+ modalities: ['MRI'],
246
+ secondaryModalities: ['MRI_Structural'],
247
+ sessions: [],
248
+ subjects: ['01', '02'],
249
+ subjectMetadata: [
250
+ {
251
+ participantId: '01',
252
+ age: 25,
253
+ sex: 'M',
254
+ group: null,
255
+ __typename: 'SubjectMetadata',
256
+ },
257
+ ],
258
+ tasks: [],
259
+ size: 623389,
260
+ totalFiles: 7,
261
+ dataProcessed: false,
262
+ pet: null,
263
+ __typename: 'Summary',
264
+ },
265
+ analytics: {
266
+ downloads: 0,
267
+ views: 24,
268
+ __typename: 'Analytic',
269
+ },
270
+ issues: [
271
+ {
272
+ severity: 'warning',
273
+ code: 82,
274
+ reason:
275
+ 'Tabular file contains custom columns not described in a data dictionary',
276
+ files: [
277
+ {
278
+ evidence:
279
+ 'Columns: sex, age not defined, please define in: /participants.json',
280
+ line: null,
281
+ character: null,
282
+ reason:
283
+ 'Tabular file contains custom columns not described in a data dictionary',
284
+ file: {
285
+ name: 'participants.tsv',
286
+ path: '/datalad/ds001032/participants.tsv',
287
+ relativePath: '/participants.tsv',
288
+ __typename: 'ValidationIssueFileDetail',
289
+ },
290
+ __typename: 'ValidationIssueFile',
291
+ },
292
+ ],
293
+ additionalFileCount: 0,
294
+ __typename: 'ValidationIssue',
295
+ },
296
+ ],
297
+ __typename: 'Snapshot',
298
+ hexsha: 'd62fdc42e2a568a6f89e33d68d3ef343ff883e02',
299
+ onBrainlife: false,
300
+ }
@@ -0,0 +1,18 @@
1
+ import React, { useState } from 'react'
2
+ import { MemoryRouter } from 'react-router-dom'
3
+ import { UserModalOpenCtx } from '../utils/user-login-modal-ctx'
4
+ import { MockedProvider } from '@apollo/client/testing'
5
+
6
+ // Provide the basics needed to render complex components with mocked router, apollo, etc
7
+ export const MockAppWrapper = ({ children }) => {
8
+ const [userModalOpen, setUserModalOpen] = useState(false)
9
+ return (
10
+ <MemoryRouter>
11
+ <MockedProvider>
12
+ <UserModalOpenCtx.Provider value={{ userModalOpen, setUserModalOpen }}>
13
+ {children}
14
+ </UserModalOpenCtx.Provider>
15
+ </MockedProvider>
16
+ </MemoryRouter>
17
+ )
18
+ }