@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
@@ -1,79 +1,104 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`File Viewer - JSON renders with invalid JSON 1`] = `
4
- <div
5
- className="container"
6
- >
4
+ <DocumentFragment>
7
5
  <div
8
- className="grid"
6
+ class="container"
9
7
  >
10
8
  <div
11
- className="col col-lg"
9
+ class="grid"
12
10
  >
13
- <h3>
14
- Tree
15
- </h3>
16
- <hr />
17
- <p>
18
- JSON failed to parse
19
- </p>
20
- <pre>
21
- Unexpected token ; in JSON at position 4
22
- </pre>
23
- </div>
24
- <div
25
- className="col"
26
- >
27
- <h3>
28
- Raw
29
- </h3>
30
- <hr />
31
- <Styled(pre)>
32
- 1234;
33
- </Styled(pre)>
11
+ <div
12
+ class="col col-lg"
13
+ >
14
+ <h3>
15
+ Tree
16
+ </h3>
17
+ <hr />
18
+ <p>
19
+ JSON failed to parse
20
+ </p>
21
+ <pre>
22
+ Unexpected token ; in JSON at position 4
23
+ </pre>
24
+ </div>
25
+ <div
26
+ class="col"
27
+ >
28
+ <h3>
29
+ Raw
30
+ </h3>
31
+ <hr />
32
+ <pre
33
+ class="css-ffm88e"
34
+ >
35
+ 1234;
36
+ </pre>
37
+ </div>
34
38
  </div>
35
39
  </div>
36
- </div>
40
+ </DocumentFragment>
37
41
  `;
38
42
 
39
43
  exports[`File Viewer - JSON renders with valid JSON 1`] = `
40
- <div
41
- className="container"
42
- >
44
+ <DocumentFragment>
43
45
  <div
44
- className="grid"
46
+ class="container"
45
47
  >
46
48
  <div
47
- className="col col-lg"
48
- >
49
- <h3>
50
- Tree
51
- </h3>
52
- <hr />
53
- <RecursiveProperty
54
- emptyPropertyLabel="Property is empty"
55
- property={
56
- Object {
57
- "name": "string",
58
- "thing": 1,
59
- }
60
- }
61
- propertyName="Root Property"
62
- propertyNameProcessor={[Function]}
63
- rootProperty={true}
64
- />
65
- </div>
66
- <div
67
- className="col"
49
+ class="grid"
68
50
  >
69
- <h3>
70
- Raw
71
- </h3>
72
- <hr />
73
- <Styled(pre)>
74
- {"thing":1,"name":"string"}
75
- </Styled(pre)>
51
+ <div
52
+ class="col col-lg"
53
+ >
54
+ <h3>
55
+ Tree
56
+ </h3>
57
+ <hr />
58
+ <div
59
+ class="json-container"
60
+ >
61
+ <div
62
+ class="expand-prop-name"
63
+ >
64
+ Root Property-
65
+ </div>
66
+ <div
67
+ class="json-container"
68
+ >
69
+ <span
70
+ class="prop-name"
71
+ >
72
+ Thing:
73
+ </span>
74
+ 1
75
+ </div>
76
+ <div
77
+ class="json-container"
78
+ >
79
+ <span
80
+ class="prop-name"
81
+ >
82
+ Name:
83
+ </span>
84
+ string
85
+ </div>
86
+ </div>
87
+ </div>
88
+ <div
89
+ class="col"
90
+ >
91
+ <h3>
92
+ Raw
93
+ </h3>
94
+ <hr />
95
+ <pre
96
+ class="css-ffm88e"
97
+ >
98
+ {"thing":1,"name":"string"}
99
+ </pre>
100
+ </div>
76
101
  </div>
77
102
  </div>
78
- </div>
103
+ </DocumentFragment>
79
104
  `;
@@ -1,15 +1,15 @@
1
1
  import React from 'react'
2
- import { shallow } from 'enzyme'
2
+ import { render } from '@testing-library/react'
3
3
  import { FileViewerJsonRaw } from '../file-viewer-json.jsx'
4
4
 
5
5
  describe('File Viewer - JSON', () => {
6
6
  it('renders with valid JSON', () => {
7
7
  const validJson = JSON.stringify({ thing: 1, name: 'string' })
8
- const wrapper = shallow(<FileViewerJsonRaw jsonRaw={validJson} />)
9
- expect(wrapper).toMatchSnapshot()
8
+ const { asFragment } = render(<FileViewerJsonRaw jsonRaw={validJson} />)
9
+ expect(asFragment()).toMatchSnapshot()
10
10
  })
11
11
  it('renders with invalid JSON', () => {
12
- const wrapper = shallow(<FileViewerJsonRaw jsonRaw="1234;" />)
13
- expect(wrapper).toMatchSnapshot()
12
+ const { asFragment } = render(<FileViewerJsonRaw jsonRaw="1234;" />)
13
+ expect(asFragment()).toMatchSnapshot()
14
14
  })
15
15
  })
@@ -1,10 +1,18 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`CancelButton component renders with default props 1`] = `
4
- <Button
5
- className="description-btn description-button-cancel"
6
- icon="fas fa-times"
7
- label="Cancel"
8
- onClick={[Function]}
9
- />
4
+ <DocumentFragment>
5
+ <button
6
+ aria-label="Cancel"
7
+ class="on-button on-button--medium on-button--default icon-text description-btn description-button-cancel"
8
+ role="button"
9
+ type="button"
10
+ >
11
+ <i
12
+ aria-hidden="true"
13
+ class="fas fa-times css-0"
14
+ />
15
+ Cancel
16
+ </button>
17
+ </DocumentFragment>
10
18
  `;
@@ -1,10 +1,18 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`EditButton component renders with default props 1`] = `
4
- <Button
5
- className="description-btn description-button-edit"
6
- icon="fas fa-edit"
7
- label="Edit"
8
- onClick={[Function]}
9
- />
4
+ <DocumentFragment>
5
+ <button
6
+ aria-label="Edit"
7
+ class="on-button on-button--medium on-button--default icon-text description-btn description-button-edit"
8
+ role="button"
9
+ type="button"
10
+ >
11
+ <i
12
+ aria-hidden="true"
13
+ class="fas fa-edit css-0"
14
+ />
15
+ Edit
16
+ </button>
17
+ </DocumentFragment>
10
18
  `;
@@ -1,10 +1,18 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`SaveButton component renders with default props 1`] = `
4
- <Button
5
- className="description-btn description-button-save"
6
- icon="fas fa-check"
7
- label="Save"
8
- onClick={[Function]}
9
- />
4
+ <DocumentFragment>
5
+ <button
6
+ aria-label="Save"
7
+ class="on-button on-button--medium on-button--default icon-text description-btn description-button-save"
8
+ role="button"
9
+ type="button"
10
+ >
11
+ <i
12
+ aria-hidden="true"
13
+ class="fas fa-check css-0"
14
+ />
15
+ Save
16
+ </button>
17
+ </DocumentFragment>
10
18
  `;
@@ -1,154 +1,227 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`SelectInput handles boolean display 1`] = `
4
- <Fragment>
5
- <Styled(div)>
6
- <Styled(label)
7
- hasValue={true}
8
- htmlFor="Expected name"
4
+ <DocumentFragment>
5
+ <div
6
+ class="css-1e7yhge"
7
+ >
8
+ <label
9
+ class="css-xlyr96"
10
+ for="Expected name"
9
11
  >
10
12
  Expected label
11
- </Styled(label)>
12
- <Styled(i)
13
- className="fa fa-asterisk"
13
+ </label>
14
+ <i
15
+ class="fa fa-asterisk css-1gx6zd3"
14
16
  />
15
- <Styled(div)>
17
+ <div
18
+ class="css-1y7plm6"
19
+ >
16
20
  true
17
- <SelectIcon />
18
- </Styled(div)>
19
- <styledSelect
20
- disabled={true}
21
+ <div
22
+ class="css-ul54qr"
23
+ >
24
+ <i
25
+ class="fa fa-caret-up"
26
+ />
27
+ <i
28
+ class="fa fa-caret-down"
29
+ />
30
+ </div>
31
+ </div>
32
+ <select
33
+ class="css-1m2rag2"
34
+ disabled=""
21
35
  name="Expected name"
22
- onChange={[Function]}
23
- value="true"
24
36
  >
25
- <Styled(option)
26
- disabled={true}
27
- hidden={true}
37
+ <option
38
+ class="css-1xu3tth"
39
+ disabled=""
40
+ hidden=""
28
41
  value=""
29
42
  />
30
- <Styled(option)
31
- key="0"
32
- value={true}
43
+ <option
44
+ class="css-1xu3tth"
45
+ value="true"
33
46
  >
34
47
  true-label
35
- </Styled(option)>
36
- <Styled(option)
37
- key="1"
38
- value={false}
48
+ </option>
49
+ <option
50
+ class="css-1xu3tth"
51
+ value="false"
39
52
  >
40
53
  false-label
41
- </Styled(option)>
42
- </styledSelect>
43
- </Styled(div)>
44
- <Styled(div)>
45
- <TextInput
46
- disabled={true}
47
- label="Other Expected label"
48
- name="Expected name"
49
- value="true"
50
- />
51
- </Styled(div)>
52
- </Fragment>
54
+ </option>
55
+ </select>
56
+ </div>
57
+ <div
58
+ class="css-vzng66"
59
+ >
60
+ <div
61
+ class="css-1k9o271"
62
+ >
63
+ <label
64
+ class="css-1y4orcj"
65
+ for="Expected name"
66
+ >
67
+ Other Expected label
68
+ </label>
69
+ <input
70
+ class="css-1v4xkzy"
71
+ disabled=""
72
+ name="Expected name"
73
+ value="true"
74
+ />
75
+ </div>
76
+ </div>
77
+ </DocumentFragment>
53
78
  `;
54
79
 
55
80
  exports[`SelectInput handles display as disabled 1`] = `
56
- <Fragment>
57
- <Styled(div)>
58
- <Styled(label)
59
- hasValue={true}
60
- htmlFor="Expected name"
81
+ <DocumentFragment>
82
+ <div
83
+ class="css-1e7yhge"
84
+ >
85
+ <label
86
+ class="css-xlyr96"
87
+ for="Expected name"
61
88
  >
62
89
  Expected label
63
- </Styled(label)>
64
- <Styled(i)
65
- className="fa fa-asterisk"
90
+ </label>
91
+ <i
92
+ class="fa fa-asterisk css-1gx6zd3"
66
93
  />
67
- <Styled(div)>
94
+ <div
95
+ class="css-1y7plm6"
96
+ >
68
97
  hi
69
- <SelectIcon />
70
- </Styled(div)>
71
- <styledSelect
72
- disabled={true}
98
+ <div
99
+ class="css-ul54qr"
100
+ >
101
+ <i
102
+ class="fa fa-caret-up"
103
+ />
104
+ <i
105
+ class="fa fa-caret-down"
106
+ />
107
+ </div>
108
+ </div>
109
+ <select
110
+ class="css-1m2rag2"
111
+ disabled=""
73
112
  name="Expected name"
74
- onChange={[Function]}
75
- value="hi"
76
113
  >
77
- <Styled(option)
78
- disabled={true}
79
- hidden={true}
114
+ <option
115
+ class="css-1xu3tth"
116
+ disabled=""
117
+ hidden=""
80
118
  value=""
81
119
  />
82
- <Styled(option)
83
- key="0"
120
+ <option
121
+ class="css-1xu3tth"
84
122
  value="hi"
85
123
  >
86
124
  hi
87
- </Styled(option)>
88
- <Styled(option)
89
- key="1"
125
+ </option>
126
+ <option
127
+ class="css-1xu3tth"
90
128
  value="bye"
91
129
  >
92
130
  bye
93
- </Styled(option)>
94
- </styledSelect>
95
- </Styled(div)>
96
- <Styled(div)>
97
- <TextInput
98
- disabled={true}
99
- label="Other Expected label"
100
- name="Expected name"
101
- value="hi"
102
- />
103
- </Styled(div)>
104
- </Fragment>
131
+ </option>
132
+ </select>
133
+ </div>
134
+ <div
135
+ class="css-vzng66"
136
+ >
137
+ <div
138
+ class="css-1k9o271"
139
+ >
140
+ <label
141
+ class="css-1y4orcj"
142
+ for="Expected name"
143
+ >
144
+ Other Expected label
145
+ </label>
146
+ <input
147
+ class="css-1v4xkzy"
148
+ disabled=""
149
+ name="Expected name"
150
+ value="hi"
151
+ />
152
+ </div>
153
+ </div>
154
+ </DocumentFragment>
105
155
  `;
106
156
 
107
157
  exports[`SelectInput handles display as not disabled 1`] = `
108
- <Fragment>
109
- <Styled(div)>
110
- <Styled(label)
111
- hasValue={true}
112
- htmlFor="Expected name"
158
+ <DocumentFragment>
159
+ <div
160
+ class="css-1e7yhge"
161
+ >
162
+ <label
163
+ class="css-xlyr96"
164
+ for="Expected name"
113
165
  >
114
166
  Expected label
115
- </Styled(label)>
116
- <Styled(div)>
167
+ </label>
168
+ <div
169
+ class="css-1y7plm6"
170
+ >
117
171
  hi
118
- <SelectIcon />
119
- </Styled(div)>
120
- <styledSelect
121
- disabled={false}
172
+ <div
173
+ class="css-ul54qr"
174
+ >
175
+ <i
176
+ class="fa fa-caret-up"
177
+ />
178
+ <i
179
+ class="fa fa-caret-down"
180
+ />
181
+ </div>
182
+ </div>
183
+ <select
184
+ class="css-1m2rag2"
122
185
  name="Expected name"
123
- onChange={[Function]}
124
- value="hi"
125
186
  >
126
- <Styled(option)
127
- disabled={true}
128
- hidden={true}
187
+ <option
188
+ class="css-1xu3tth"
189
+ disabled=""
190
+ hidden=""
129
191
  value=""
130
192
  />
131
- <Styled(option)
132
- key="0"
193
+ <option
194
+ class="css-1xu3tth"
133
195
  value="hi"
134
196
  >
135
197
  hi
136
- </Styled(option)>
137
- <Styled(option)
138
- key="1"
198
+ </option>
199
+ <option
200
+ class="css-1xu3tth"
139
201
  value="bye"
140
202
  >
141
203
  bye
142
- </Styled(option)>
143
- </styledSelect>
144
- </Styled(div)>
145
- <Styled(div)>
146
- <TextInput
147
- disabled={false}
148
- label="Other Expected label"
149
- name="Expected name"
150
- value="hi"
151
- />
152
- </Styled(div)>
153
- </Fragment>
204
+ </option>
205
+ </select>
206
+ </div>
207
+ <div
208
+ class="css-vzng66"
209
+ >
210
+ <div
211
+ class="css-1k9o271"
212
+ >
213
+ <label
214
+ class="css-1y4orcj"
215
+ for="Expected name"
216
+ >
217
+ Other Expected label
218
+ </label>
219
+ <input
220
+ class="css-1v4xkzy"
221
+ name="Expected name"
222
+ value="hi"
223
+ />
224
+ </div>
225
+ </div>
226
+ </DocumentFragment>
154
227
  `;
@@ -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 { CancelButton } from '../cancel-button'
4
4
 
5
5
  describe('CancelButton component', () => {
6
6
  it('renders with default props', () => {
7
- const wrapper = shallow(<CancelButton action={() => {}} />)
8
- expect(wrapper).toMatchSnapshot()
7
+ const { asFragment } = render(<CancelButton action={() => {}} />)
8
+ expect(asFragment()).toMatchSnapshot()
9
9
  })
10
10
  })
@@ -0,0 +1,72 @@
1
+ import React from 'react'
2
+ import { render, screen } from '@testing-library/react'
3
+ import '@testing-library/jest-dom/extend-expect'
4
+ import { MemoryRouter } from 'react-router-dom'
5
+ import { DatasetAlertDraft } from '../dataset-alert-draft'
6
+
7
+ describe('DatasetAlertDraft component', () => {
8
+ it('renders the correct text for private drafts with changes', () => {
9
+ render(
10
+ <DatasetAlertDraft
11
+ isPrivate
12
+ hasSnapshot
13
+ hasDraftChanges
14
+ datasetId="test00001"
15
+ />,
16
+ { wrapper: MemoryRouter },
17
+ )
18
+
19
+ expect(
20
+ screen.queryByText(/there have been changes to the draft/i),
21
+ ).toBeInTheDocument()
22
+ })
23
+ it('renders the correct text for private drafts with no snapshots', () => {
24
+ render(
25
+ <DatasetAlertDraft
26
+ isPrivate
27
+ hasDraftChanges
28
+ hasSnapshot={false}
29
+ datasetId="test00001"
30
+ />,
31
+ { wrapper: MemoryRouter },
32
+ )
33
+
34
+ expect(
35
+ screen.queryByText(/before it can be published/i),
36
+ ).toBeInTheDocument()
37
+ })
38
+ it('renders the correct text for public drafts with changes', () => {
39
+ render(
40
+ <DatasetAlertDraft
41
+ hasDraftChanges
42
+ isPrivate={false}
43
+ hasSnapshot={false}
44
+ datasetId="test00001"
45
+ />,
46
+ {
47
+ wrapper: MemoryRouter,
48
+ },
49
+ )
50
+
51
+ expect(
52
+ screen.queryByText(/there are currently unsaved changes to this draft/i),
53
+ ).toBeInTheDocument()
54
+ })
55
+ it('renders the correct text for public drafts without changes', () => {
56
+ render(
57
+ <DatasetAlertDraft
58
+ hasDraftChanges={false}
59
+ isPrivate={false}
60
+ hasSnapshot={false}
61
+ datasetId="test00001"
62
+ />,
63
+ {
64
+ wrapper: MemoryRouter,
65
+ },
66
+ )
67
+
68
+ expect(
69
+ screen.queryByText(/you can make changes to this draft page/i),
70
+ ).toBeInTheDocument()
71
+ })
72
+ })