@truedat/dd 4.43.6 → 4.44.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.
- package/CHANGELOG.md +6 -0
- package/package.json +6 -6
- package/src/api/fragments.js +10 -0
- package/src/api/mutations.js +28 -0
- package/src/api/queries.js +20 -0
- package/src/api.js +0 -4
- package/src/components/DictionaryRoutes.js +2 -10
- package/src/components/LinkStructureTagForm.js +2 -2
- package/src/components/LinkedStructureTag.js +16 -7
- package/src/components/StructureLinkTagButton.js +8 -11
- package/src/components/StructureSummary.js +1 -1
- package/src/components/StructureTag.js +59 -20
- package/src/components/StructureTagForm.js +30 -35
- package/src/components/StructureTags.js +7 -6
- package/src/components/StructureTagsCards.js +56 -59
- package/src/components/StructureTagsCrumbs.js +4 -4
- package/src/components/StructureTagsRoutes.js +33 -57
- package/src/components/StructuresRoutes.js +0 -3
- package/src/components/TagsHeader.js +14 -21
- package/src/components/__tests__/PendingStructureNoteRow.spec.js +5 -1
- package/src/components/__tests__/PendingStructureNotes.spec.js +2 -2
- package/src/components/__tests__/StructureTag.spec.js +4 -1
- package/src/components/__tests__/StructureTagForm.spec.js +40 -82
- package/src/components/__tests__/StructureTags.spec.js +7 -7
- package/src/components/__tests__/StructureTagsCards.spec.js +38 -36
- package/src/components/__tests__/StructuresUploadEventsTable.spec.js +36 -42
- package/src/components/__tests__/__snapshots__/DictionaryRoutes.spec.js.snap +3 -3
- package/src/components/__tests__/__snapshots__/PendingStructureNoteRow.spec.js.snap +33 -29
- package/src/components/__tests__/__snapshots__/StructureTag.spec.js.snap +13 -2
- package/src/components/__tests__/__snapshots__/StructureTagForm.spec.js.snap +7 -56
- package/src/components/__tests__/__snapshots__/StructureTags.spec.js.snap +32 -44
- package/src/components/__tests__/__snapshots__/StructureTagsCards.spec.js.snap +53 -118
- package/src/components/__tests__/__snapshots__/StructureTagsCrumbs.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/StructureTypes.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/StructureTypesCrumbs.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/StructureTypesTable.spec.js.snap +2 -2
- package/src/messages/en.js +1 -0
- package/src/messages/es.js +1 -0
- package/src/reducers/__tests__/editableStructureTags.spec.js +39 -0
- package/src/reducers/__tests__/structureTagsSaving.spec.js +40 -0
- package/src/reducers/__tests__/structuresUploadEventsLoading.spec.js +18 -4
- package/src/reducers/editableStructureTags.js +19 -0
- package/src/reducers/index.js +4 -9
- package/src/reducers/structureTagSaving.js +18 -0
- package/src/routines.js +3 -5
- package/src/sagas/__tests__/createStructureTag.spec.js +28 -13
- package/src/sagas/__tests__/deleteStructureTag.spec.js +27 -15
- package/src/sagas/__tests__/updateStructureTag.spec.js +26 -13
- package/src/sagas/createStructureTag.js +15 -13
- package/src/sagas/deleteStructureTag.js +13 -8
- package/src/sagas/index.js +0 -6
- package/src/sagas/updateStructureTag.js +8 -15
- package/src/selectors/__tests__/getStructuresUploadEventColumns.spec.js +1 -1
- package/src/components/StructureTagLoader.js +0 -28
- package/src/components/StructureTagsLoader.js +0 -26
- package/src/components/__tests__/StructureTagLoader.spec.js +0 -29
- package/src/components/__tests__/StructureTagsLoader.spec.js +0 -24
- package/src/components/__tests__/__snapshots__/StructureTagLoader.spec.js.snap +0 -3
- package/src/components/__tests__/__snapshots__/StructureTagsLoader.spec.js.snap +0 -3
- package/src/reducers/__tests__/structureTag.spec.js +0 -80
- package/src/reducers/__tests__/structureTagLoading.spec.js +0 -40
- package/src/reducers/__tests__/structureTags.spec.js +0 -32
- package/src/reducers/__tests__/structureTagsLoading.spec.js +0 -40
- package/src/reducers/structureTag.js +0 -38
- package/src/reducers/structureTagLoading.js +0 -16
- package/src/reducers/structureTags.js +0 -19
- package/src/reducers/structureTagsLoading.js +0 -16
- package/src/sagas/__tests__/deleteStructureType.spec.js +0 -70
- package/src/sagas/__tests__/fetchStructureTag.spec.js +0 -74
- package/src/sagas/__tests__/fetchStructureTags.spec.js +0 -72
- package/src/sagas/fetchStructureTag.js +0 -29
- package/src/sagas/fetchStructureTags.js +0 -25
|
@@ -2,34 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`<PendingStructureNoteRow /> matches the latest snapshot 1`] = `
|
|
4
4
|
<div>
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
5
|
+
<table>
|
|
6
|
+
<tbody>
|
|
7
|
+
<tr
|
|
8
|
+
class=""
|
|
9
|
+
>
|
|
10
|
+
<td
|
|
11
|
+
class=""
|
|
12
|
+
>
|
|
13
|
+
bar
|
|
14
|
+
</td>
|
|
15
|
+
<td
|
|
16
|
+
class=""
|
|
17
|
+
>
|
|
18
|
+
Draft
|
|
19
|
+
</td>
|
|
20
|
+
<td
|
|
21
|
+
class=""
|
|
22
|
+
>
|
|
23
|
+
bar system
|
|
24
|
+
</td>
|
|
25
|
+
<td
|
|
26
|
+
class=""
|
|
27
|
+
>
|
|
28
|
+
bar domain
|
|
29
|
+
</td>
|
|
30
|
+
<td
|
|
31
|
+
class=""
|
|
32
|
+
>
|
|
33
|
+
bar rute
|
|
34
|
+
</td>
|
|
35
|
+
</tr>
|
|
36
|
+
</tbody>
|
|
37
|
+
</table>
|
|
34
38
|
</div>
|
|
35
39
|
`;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`<StructureTag /> matches the latest snapshot 1`] = `
|
|
4
4
|
<Fragment>
|
|
5
|
+
<StructureTagsCrumbs
|
|
6
|
+
action="structureTags.actions.create"
|
|
7
|
+
/>
|
|
5
8
|
<Container
|
|
6
9
|
as={[Function]}
|
|
7
10
|
text={true}
|
|
@@ -15,11 +18,19 @@ exports[`<StructureTag /> matches the latest snapshot 1`] = `
|
|
|
15
18
|
/>
|
|
16
19
|
<HeaderContent>
|
|
17
20
|
<MemoizedFormattedMessage
|
|
18
|
-
id="structureTags.actions.
|
|
21
|
+
id="structureTags.actions.create"
|
|
19
22
|
/>
|
|
20
23
|
</HeaderContent>
|
|
21
24
|
</Header>
|
|
22
|
-
<
|
|
25
|
+
<StructureTagForm
|
|
26
|
+
onSubmit={[MockFunction]}
|
|
27
|
+
structureTag={
|
|
28
|
+
Object {
|
|
29
|
+
"domainIds": Array [],
|
|
30
|
+
"name": "",
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/>
|
|
23
34
|
</Container>
|
|
24
35
|
</Fragment>
|
|
25
36
|
`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<StructureTagForm /> matches the latest snapshot
|
|
3
|
+
exports[`<StructureTagForm /> matches the latest snapshot 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<form
|
|
6
|
-
class="ui form"
|
|
6
|
+
class="ui loading form"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
9
|
class="required field"
|
|
@@ -11,7 +11,7 @@ exports[`<StructureTagForm /> matches the latest snapshot create 1`] = `
|
|
|
11
11
|
<label
|
|
12
12
|
for="name"
|
|
13
13
|
>
|
|
14
|
-
|
|
14
|
+
Name
|
|
15
15
|
</label>
|
|
16
16
|
<div
|
|
17
17
|
class="ui input"
|
|
@@ -19,10 +19,10 @@ exports[`<StructureTagForm /> matches the latest snapshot create 1`] = `
|
|
|
19
19
|
<input
|
|
20
20
|
autocomplete="off"
|
|
21
21
|
id="name"
|
|
22
|
-
placeholder="
|
|
22
|
+
placeholder="Name"
|
|
23
23
|
required=""
|
|
24
24
|
type="text"
|
|
25
|
-
value=""
|
|
25
|
+
value="foo"
|
|
26
26
|
/>
|
|
27
27
|
</div>
|
|
28
28
|
</div>
|
|
@@ -35,63 +35,14 @@ exports[`<StructureTagForm /> matches the latest snapshot create 1`] = `
|
|
|
35
35
|
tabindex="-1"
|
|
36
36
|
type="submit"
|
|
37
37
|
>
|
|
38
|
-
|
|
38
|
+
Save
|
|
39
39
|
</button>
|
|
40
40
|
<a
|
|
41
41
|
class="ui secondary button"
|
|
42
42
|
href="/"
|
|
43
43
|
role="button"
|
|
44
44
|
>
|
|
45
|
-
|
|
46
|
-
</a>
|
|
47
|
-
</div>
|
|
48
|
-
</form>
|
|
49
|
-
</div>
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
|
-
exports[`<StructureTagForm /> matches the latest snapshot edit 1`] = `
|
|
53
|
-
<div>
|
|
54
|
-
<form
|
|
55
|
-
class="ui form"
|
|
56
|
-
>
|
|
57
|
-
<div
|
|
58
|
-
class="required field"
|
|
59
|
-
>
|
|
60
|
-
<label
|
|
61
|
-
for="name"
|
|
62
|
-
>
|
|
63
|
-
structureTagForm.props.name
|
|
64
|
-
</label>
|
|
65
|
-
<div
|
|
66
|
-
class="ui input"
|
|
67
|
-
>
|
|
68
|
-
<input
|
|
69
|
-
autocomplete="off"
|
|
70
|
-
id="name"
|
|
71
|
-
placeholder="structureTagForm.props.name"
|
|
72
|
-
required=""
|
|
73
|
-
type="text"
|
|
74
|
-
value="tag1"
|
|
75
|
-
/>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
<div
|
|
79
|
-
class="actions"
|
|
80
|
-
>
|
|
81
|
-
<button
|
|
82
|
-
class="ui primary disabled right floated button"
|
|
83
|
-
disabled=""
|
|
84
|
-
tabindex="-1"
|
|
85
|
-
type="submit"
|
|
86
|
-
>
|
|
87
|
-
actions.submit
|
|
88
|
-
</button>
|
|
89
|
-
<a
|
|
90
|
-
class="ui secondary button"
|
|
91
|
-
href="/"
|
|
92
|
-
role="button"
|
|
93
|
-
>
|
|
94
|
-
actions.cancel
|
|
45
|
+
Cancel
|
|
95
46
|
</a>
|
|
96
47
|
</div>
|
|
97
48
|
</form>
|
|
@@ -1,50 +1,38 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<StructureTags /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui segment"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
content={
|
|
24
|
-
<Memo(MemoizedFormattedMessage)
|
|
25
|
-
id="structureTags.actions.create"
|
|
26
|
-
/>
|
|
27
|
-
}
|
|
28
|
-
floated="right"
|
|
29
|
-
primary={true}
|
|
30
|
-
to="/structure_tags/new"
|
|
31
|
-
/>
|
|
32
|
-
<Icon
|
|
33
|
-
as="i"
|
|
34
|
-
circular={true}
|
|
35
|
-
name="tags"
|
|
36
|
-
/>
|
|
37
|
-
<HeaderContent>
|
|
38
|
-
<MemoizedFormattedMessage
|
|
39
|
-
id="structureTags.header"
|
|
8
|
+
<h2
|
|
9
|
+
class="ui header"
|
|
10
|
+
>
|
|
11
|
+
<a
|
|
12
|
+
class="ui primary right floated button"
|
|
13
|
+
href="/structureTags/new"
|
|
14
|
+
role="button"
|
|
15
|
+
>
|
|
16
|
+
Create Structure Tag
|
|
17
|
+
</a>
|
|
18
|
+
<i
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
class="tags circular icon"
|
|
40
21
|
/>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</
|
|
22
|
+
<div
|
|
23
|
+
class="content"
|
|
24
|
+
>
|
|
25
|
+
Structure tags management
|
|
26
|
+
<div
|
|
27
|
+
class="sub header"
|
|
28
|
+
>
|
|
29
|
+
Tags for Data Catalog
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</h2>
|
|
33
|
+
<div
|
|
34
|
+
class="ui active loader"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
50
38
|
`;
|
|
@@ -1,135 +1,70 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<StructureTagsCards /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
exports[`<StructureTagsCards /> matches the latest snapshot, renders a link for each tag 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui cards"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="ui card"
|
|
8
10
|
>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"propTypes": Object {
|
|
16
|
-
"innerRef": [Function],
|
|
17
|
-
"onClick": [Function],
|
|
18
|
-
"replace": [Function],
|
|
19
|
-
"target": [Function],
|
|
20
|
-
"to": [Function],
|
|
21
|
-
},
|
|
22
|
-
"render": [Function],
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
to="/structure_tags/1/edit"
|
|
11
|
+
<div
|
|
12
|
+
class="content"
|
|
13
|
+
>
|
|
14
|
+
<a
|
|
15
|
+
class="header"
|
|
16
|
+
href="/structureTags/1/edit"
|
|
26
17
|
>
|
|
27
18
|
tag1
|
|
28
|
-
</
|
|
29
|
-
</
|
|
30
|
-
<
|
|
31
|
-
extra
|
|
19
|
+
</a>
|
|
20
|
+
</div>
|
|
21
|
+
<div
|
|
22
|
+
class="extra content"
|
|
32
23
|
>
|
|
33
24
|
<div
|
|
34
|
-
|
|
25
|
+
class="ui actions"
|
|
35
26
|
>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
</i>,
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/>
|
|
48
|
-
}
|
|
49
|
-
header={
|
|
50
|
-
<Memo(MemoizedFormattedMessage)
|
|
51
|
-
id="structureTags.actions.delete.confirmation.header"
|
|
52
|
-
/>
|
|
53
|
-
}
|
|
54
|
-
icon="trash"
|
|
55
|
-
onConfirm={[Function]}
|
|
56
|
-
trigger={
|
|
57
|
-
<Button
|
|
58
|
-
as="button"
|
|
59
|
-
basic={true}
|
|
60
|
-
color="red"
|
|
61
|
-
icon="trash"
|
|
62
|
-
/>
|
|
63
|
-
}
|
|
64
|
-
/>
|
|
27
|
+
<button
|
|
28
|
+
class="ui red basic icon button"
|
|
29
|
+
>
|
|
30
|
+
<i
|
|
31
|
+
aria-hidden="true"
|
|
32
|
+
class="trash icon"
|
|
33
|
+
/>
|
|
34
|
+
</button>
|
|
65
35
|
</div>
|
|
66
|
-
</
|
|
67
|
-
</
|
|
68
|
-
<
|
|
69
|
-
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<div
|
|
39
|
+
class="ui card"
|
|
70
40
|
>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"propTypes": Object {
|
|
78
|
-
"innerRef": [Function],
|
|
79
|
-
"onClick": [Function],
|
|
80
|
-
"replace": [Function],
|
|
81
|
-
"target": [Function],
|
|
82
|
-
"to": [Function],
|
|
83
|
-
},
|
|
84
|
-
"render": [Function],
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
to="/structure_tags/2/edit"
|
|
41
|
+
<div
|
|
42
|
+
class="content"
|
|
43
|
+
>
|
|
44
|
+
<a
|
|
45
|
+
class="header"
|
|
46
|
+
href="/structureTags/2/edit"
|
|
88
47
|
>
|
|
89
48
|
tag2
|
|
90
|
-
</
|
|
91
|
-
</
|
|
92
|
-
<
|
|
93
|
-
extra
|
|
49
|
+
</a>
|
|
50
|
+
</div>
|
|
51
|
+
<div
|
|
52
|
+
class="extra content"
|
|
94
53
|
>
|
|
95
54
|
<div
|
|
96
|
-
|
|
55
|
+
class="ui actions"
|
|
97
56
|
>
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
'tag2'
|
|
107
|
-
</i>,
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/>
|
|
111
|
-
}
|
|
112
|
-
header={
|
|
113
|
-
<Memo(MemoizedFormattedMessage)
|
|
114
|
-
id="structureTags.actions.delete.confirmation.header"
|
|
115
|
-
/>
|
|
116
|
-
}
|
|
117
|
-
icon="trash"
|
|
118
|
-
onConfirm={[Function]}
|
|
119
|
-
trigger={
|
|
120
|
-
<Button
|
|
121
|
-
as="button"
|
|
122
|
-
basic={true}
|
|
123
|
-
color="red"
|
|
124
|
-
icon="trash"
|
|
125
|
-
/>
|
|
126
|
-
}
|
|
127
|
-
/>
|
|
57
|
+
<button
|
|
58
|
+
class="ui red basic icon button"
|
|
59
|
+
>
|
|
60
|
+
<i
|
|
61
|
+
aria-hidden="true"
|
|
62
|
+
class="trash icon"
|
|
63
|
+
/>
|
|
64
|
+
</button>
|
|
128
65
|
</div>
|
|
129
|
-
</
|
|
130
|
-
</
|
|
131
|
-
</
|
|
132
|
-
</
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
133
70
|
`;
|
|
134
|
-
|
|
135
|
-
exports[`<StructureTagsCards /> matches the latest snapshot for empty 1`] = `<EmptyMessage />`;
|
|
@@ -46,7 +46,7 @@ exports[`<StructureTypesTable /> matches the latest snapshot 1`] = `
|
|
|
46
46
|
class=""
|
|
47
47
|
>
|
|
48
48
|
<a
|
|
49
|
-
href="/
|
|
49
|
+
href="/structureTypes/2/edit"
|
|
50
50
|
>
|
|
51
51
|
col
|
|
52
52
|
</a>
|
|
@@ -73,7 +73,7 @@ exports[`<StructureTypesTable /> matches the latest snapshot 1`] = `
|
|
|
73
73
|
class=""
|
|
74
74
|
>
|
|
75
75
|
<a
|
|
76
|
-
href="/
|
|
76
|
+
href="/structureTypes/1/edit"
|
|
77
77
|
>
|
|
78
78
|
doc
|
|
79
79
|
</a>
|
package/src/messages/en.js
CHANGED
|
@@ -327,6 +327,7 @@ export default {
|
|
|
327
327
|
"structureDomain.actions.update": "Update",
|
|
328
328
|
"structureDomain.actions.update.inherit": "Apply on children",
|
|
329
329
|
"structureSelector.union.criteria": "Union criteria",
|
|
330
|
+
"structureTagForm.props.domains": "Domains",
|
|
330
331
|
"structureTagForm.props.name": "Name",
|
|
331
332
|
"structureTags.actions.create": "Create Structure Tag",
|
|
332
333
|
"structureTags.actions.delete.confirmation.content":
|
package/src/messages/es.js
CHANGED
|
@@ -332,6 +332,7 @@ export default {
|
|
|
332
332
|
"structureDomain.actions.update": "Actualizar",
|
|
333
333
|
"structureDomain.actions.update.inherit": "Aplicar en hijos",
|
|
334
334
|
"structureSelector.union.criteria": "Criterio de unión",
|
|
335
|
+
"structureTagForm.props.domains": "Dominios",
|
|
335
336
|
"structureTagForm.props.name": "Nombre",
|
|
336
337
|
"structureTags.actions.create": "Crear Etiqueta de Estructura",
|
|
337
338
|
"structureTags.actions.delete.confirmation.content":
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { clearStructure, fetchStructure } from "../../routines";
|
|
2
|
+
import { editableStructureTags, initialState } from "../editableStructureTags";
|
|
3
|
+
|
|
4
|
+
const fooState = [{ foo: "bar" }];
|
|
5
|
+
|
|
6
|
+
describe("reducers: editableStructureTags", () => {
|
|
7
|
+
it("should provide the initial state", () => {
|
|
8
|
+
expect(editableStructureTags(undefined, {})).toBe(initialState);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("should handle the clearStructure.TRIGGER action", () => {
|
|
12
|
+
expect(editableStructureTags(fooState, clearStructure())).toBe(
|
|
13
|
+
initialState
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should handle the fetchStructure.TRIGGER action", () => {
|
|
18
|
+
expect(editableStructureTags(fooState, fetchStructure())).toBe(
|
|
19
|
+
initialState
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("should handle the fetchStructure.SUCCESS action", () => {
|
|
24
|
+
const data = [
|
|
25
|
+
{ id: 1, name: "TAG 1" },
|
|
26
|
+
{ id: 2, name: "TAG 2" },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const payload = { _actions: { manage_tags: { data } } };
|
|
30
|
+
|
|
31
|
+
expect(
|
|
32
|
+
editableStructureTags(fooState, fetchStructure.success(payload))
|
|
33
|
+
).toMatchObject(data);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should ignore unknown actions", () => {
|
|
37
|
+
expect(editableStructureTags(fooState, { type: "FOO" })).toBe(fooState);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createStructureTag, updateStructureTag } from "../../routines";
|
|
2
|
+
import { structureTagSaving } from "..";
|
|
3
|
+
|
|
4
|
+
const fooState = { foo: "bar" };
|
|
5
|
+
|
|
6
|
+
describe("reducers: structureTagSaving", () => {
|
|
7
|
+
const initialState = false;
|
|
8
|
+
|
|
9
|
+
it("should provide the initial state", () => {
|
|
10
|
+
expect(structureTagSaving(undefined, {})).toBe(initialState);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should handle the createStructureTag.TRIGGER action", () => {
|
|
14
|
+
expect(
|
|
15
|
+
structureTagSaving(fooState, { type: createStructureTag.TRIGGER })
|
|
16
|
+
).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should handle the createStructureTag.FULFILL action", () => {
|
|
20
|
+
expect(
|
|
21
|
+
structureTagSaving(fooState, { type: createStructureTag.FULFILL })
|
|
22
|
+
).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should handle the updateStructureTag.TRIGGER action", () => {
|
|
26
|
+
expect(
|
|
27
|
+
structureTagSaving(fooState, { type: updateStructureTag.TRIGGER })
|
|
28
|
+
).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should handle the updateStructureTag.FULFILL action", () => {
|
|
32
|
+
expect(
|
|
33
|
+
structureTagSaving(fooState, { type: updateStructureTag.FULFILL })
|
|
34
|
+
).toBe(false);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("should ignore unknown actions", () => {
|
|
38
|
+
expect(structureTagSaving(fooState, { type: "FOO" })).toBe(fooState);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -9,18 +9,32 @@ describe("reducers: structuresUploadEventsLoading", () => {
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
it("should be true after receiving the fetchStructuresUploadEvents.REQUEST action", () => {
|
|
12
|
-
expect(
|
|
12
|
+
expect(
|
|
13
|
+
structuresUploadEventsLoading(fooState, {
|
|
14
|
+
type: fetchStructuresUploadEvents.REQUEST,
|
|
15
|
+
})
|
|
16
|
+
).toBe(true);
|
|
13
17
|
});
|
|
14
18
|
|
|
15
19
|
it("should be false after receiving the fetchStructuresUploadEvents.SUCCESS action", () => {
|
|
16
|
-
expect(
|
|
20
|
+
expect(
|
|
21
|
+
structuresUploadEventsLoading(fooState, {
|
|
22
|
+
type: fetchStructuresUploadEvents.SUCCESS,
|
|
23
|
+
})
|
|
24
|
+
).toBe(false);
|
|
17
25
|
});
|
|
18
26
|
|
|
19
27
|
it("should be false after receiving the fetchStructuresUploadEvents.FAILURE action", () => {
|
|
20
|
-
expect(
|
|
28
|
+
expect(
|
|
29
|
+
structuresUploadEventsLoading(fooState, {
|
|
30
|
+
type: fetchStructuresUploadEvents.FAILURE,
|
|
31
|
+
})
|
|
32
|
+
).toBe(false);
|
|
21
33
|
});
|
|
22
34
|
|
|
23
35
|
it("should ignore unhandled actions", () => {
|
|
24
|
-
expect(structuresUploadEventsLoading(fooState, { type: "FOO" })).toBe(
|
|
36
|
+
expect(structuresUploadEventsLoading(fooState, { type: "FOO" })).toBe(
|
|
37
|
+
fooState
|
|
38
|
+
);
|
|
25
39
|
});
|
|
26
40
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import { clearStructure, fetchStructure } from "../routines";
|
|
3
|
+
|
|
4
|
+
export const initialState = [];
|
|
5
|
+
|
|
6
|
+
const editableStructureTags = (state = initialState, { type, payload }) => {
|
|
7
|
+
switch (type) {
|
|
8
|
+
case clearStructure.TRIGGER:
|
|
9
|
+
return initialState;
|
|
10
|
+
case fetchStructure.TRIGGER:
|
|
11
|
+
return initialState;
|
|
12
|
+
case fetchStructure.SUCCESS:
|
|
13
|
+
return _.pathOr(initialState, "_actions.manage_tags.data")(payload);
|
|
14
|
+
default:
|
|
15
|
+
return state;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { editableStructureTags };
|