@truedat/dd 4.48.5 → 4.48.8
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 +5 -5
- package/src/components/StructureChildrenRelations.js +6 -14
- package/src/components/StructureCrumbs.js +43 -25
- package/src/components/StructureFieldRow.js +12 -10
- package/src/components/StructureFields.js +7 -7
- package/src/components/StructureItem.js +2 -2
- package/src/components/StructureSummary.js +4 -6
- package/src/components/__tests__/StructureFieldRow.spec.js +37 -33
- package/src/components/__tests__/StructureFields.spec.js +26 -27
- package/src/components/__tests__/StructureItem.spec.js +1 -1
- package/src/components/__tests__/StructureItems.spec.js +1 -3
- package/src/components/__tests__/StructureSummary.spec.js +1 -4
- package/src/components/__tests__/__snapshots__/StructureFieldRow.spec.js.snap +71 -74
- package/src/components/__tests__/__snapshots__/StructureFields.spec.js.snap +132 -160
- package/src/messages/en.js +6 -6
- package/src/messages/es.js +6 -6
- package/src/reducers/structure.js +5 -5
- package/src/reducers/structures.js +2 -2
- package/src/selectors/__tests__/getSortedFields.spec.js +11 -11
- package/src/selectors/__tests__/getStructureParent.spec.js +10 -10
- package/src/selectors/getStructureFieldColumns.js +29 -39
- package/src/selectors/getStructureParent.js +2 -7
- package/src/selectors/getStructureSortingCriteria.js +7 -5
- package/src/selectors/structureColumnsSelector.js +2 -6
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.48.
|
|
3
|
+
"version": "4.48.8",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@apollo/client": "^3.6.4",
|
|
91
|
-
"@truedat/auth": "4.48.
|
|
92
|
-
"@truedat/core": "4.48.
|
|
93
|
-
"@truedat/df": "4.48.
|
|
91
|
+
"@truedat/auth": "4.48.8",
|
|
92
|
+
"@truedat/core": "4.48.8",
|
|
93
|
+
"@truedat/df": "4.48.8",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
96
96
|
"prop-types": "^15.8.1",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"react-dom": ">= 16.8.6 < 17",
|
|
113
113
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "e49b195088068688520a1cb02c64127e140615e6"
|
|
116
116
|
}
|
|
@@ -2,23 +2,15 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
|
+
import { columnPredicate } from "@truedat/core/services";
|
|
5
6
|
import {
|
|
6
7
|
getChildrenRelationColumns,
|
|
7
|
-
getSortedChildrenRelations
|
|
8
|
+
getSortedChildrenRelations,
|
|
8
9
|
} from "../selectors";
|
|
9
10
|
import StructureRelations from "./StructureRelations";
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const field = _.isFunction(fieldSelector)
|
|
14
|
-
? fieldSelector
|
|
15
|
-
: _.path(_.defaultTo(name)(fieldSelector));
|
|
16
|
-
return name === "links" ? _.flow(field, _.negate(_.isEmpty)) : field;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const filterColumns = (columns, relations) => {
|
|
20
|
-
return _.filter(column => _.any(columnPredicate(column))(relations))(columns);
|
|
21
|
-
};
|
|
12
|
+
const filterColumns = (columns, relations) =>
|
|
13
|
+
_.filter((c) => _.any(columnPredicate(c))(relations))(columns);
|
|
22
14
|
|
|
23
15
|
export const StructureChildrenRelations = ({ columns, relations, ...rest }) => (
|
|
24
16
|
<StructureRelations columns={columns} relations={relations} {...rest} />
|
|
@@ -26,7 +18,7 @@ export const StructureChildrenRelations = ({ columns, relations, ...rest }) => (
|
|
|
26
18
|
|
|
27
19
|
StructureChildrenRelations.propTypes = {
|
|
28
20
|
columns: PropTypes.array,
|
|
29
|
-
relations: PropTypes.array
|
|
21
|
+
relations: PropTypes.array,
|
|
30
22
|
};
|
|
31
23
|
|
|
32
24
|
const mapStateToProps = (state, ownProps) => ({
|
|
@@ -34,7 +26,7 @@ const mapStateToProps = (state, ownProps) => ({
|
|
|
34
26
|
columns: filterColumns(
|
|
35
27
|
_.propOr(getChildrenRelationColumns(state), "columns")(ownProps),
|
|
36
28
|
state.childrenRelations
|
|
37
|
-
)
|
|
29
|
+
),
|
|
38
30
|
});
|
|
39
31
|
|
|
40
32
|
export default connect(mapStateToProps)(StructureChildrenRelations);
|
|
@@ -16,7 +16,7 @@ export const StructuresCrumb = () => (
|
|
|
16
16
|
</>
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
export const SystemCrumb = ({
|
|
19
|
+
export const SystemCrumb = ({ id, name }) => (
|
|
20
20
|
<>
|
|
21
21
|
<Breadcrumb.Section
|
|
22
22
|
as={Link}
|
|
@@ -29,21 +29,28 @@ export const SystemCrumb = ({ name, id }) => (
|
|
|
29
29
|
</>
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
SystemCrumb.propTypes = {
|
|
33
|
+
id: PropTypes.number,
|
|
34
|
+
name: PropTypes.string,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const AncestorCrumb = ({ name, id }) => (
|
|
33
38
|
<>
|
|
34
39
|
<Breadcrumb.Section as={Link} to={linkTo.STRUCTURE({ id })} active={false}>
|
|
35
|
-
{
|
|
40
|
+
{name}
|
|
36
41
|
</Breadcrumb.Section>
|
|
37
42
|
<Breadcrumb.Divider icon="right angle" />
|
|
38
43
|
</>
|
|
39
44
|
);
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
AncestorCrumb.propTypes = {
|
|
47
|
+
id: PropTypes.number,
|
|
48
|
+
name: PropTypes.string,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const StructureCrumb = ({ name, id, version }) =>
|
|
42
52
|
_.isNil(version) ? (
|
|
43
|
-
<Breadcrumb.Section
|
|
44
|
-
active
|
|
45
|
-
content={_.isEmpty(published_note?.alias) ? name : published_note.alias}
|
|
46
|
-
/>
|
|
53
|
+
<Breadcrumb.Section active content={name} />
|
|
47
54
|
) : (
|
|
48
55
|
<>
|
|
49
56
|
<Breadcrumb.Section
|
|
@@ -51,46 +58,56 @@ export const StructureCrumb = ({ name, id, version, published_note }) =>
|
|
|
51
58
|
to={linkTo.STRUCTURE({ id })}
|
|
52
59
|
active={false}
|
|
53
60
|
>
|
|
54
|
-
{
|
|
61
|
+
{name}
|
|
55
62
|
</Breadcrumb.Section>
|
|
56
63
|
<Breadcrumb.Divider icon="right angle" />
|
|
57
64
|
</>
|
|
58
65
|
);
|
|
59
66
|
|
|
67
|
+
StructureCrumb.propTypes = {
|
|
68
|
+
id: PropTypes.number,
|
|
69
|
+
alias: PropTypes.string,
|
|
70
|
+
name: PropTypes.string,
|
|
71
|
+
version: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
72
|
+
};
|
|
73
|
+
|
|
60
74
|
export const VersionCrumb = ({ version }) => (
|
|
61
75
|
<Breadcrumb.Section active>
|
|
62
76
|
<FormattedMessage id="structure.crumbs.version" values={{ version }} />
|
|
63
77
|
</Breadcrumb.Section>
|
|
64
78
|
);
|
|
65
79
|
|
|
80
|
+
VersionCrumb.propTypes = {
|
|
81
|
+
version: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
82
|
+
};
|
|
83
|
+
|
|
66
84
|
export const StructureCrumbs = ({
|
|
67
85
|
id,
|
|
68
86
|
system,
|
|
69
87
|
ancestry,
|
|
88
|
+
alias,
|
|
70
89
|
name,
|
|
71
90
|
version,
|
|
72
|
-
published_note,
|
|
73
91
|
}) =>
|
|
74
92
|
name ? (
|
|
75
93
|
<Breadcrumb>
|
|
76
94
|
<StructuresCrumb />
|
|
77
|
-
{
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
{_.isEmpty(system) ? null : <SystemCrumb {...system} />}
|
|
96
|
+
{_.isEmpty(ancestry)
|
|
97
|
+
? null
|
|
98
|
+
: _.map(({ data_structure_id, name }) => (
|
|
99
|
+
<AncestorCrumb
|
|
100
|
+
key={data_structure_id}
|
|
101
|
+
name={name}
|
|
102
|
+
id={data_structure_id}
|
|
103
|
+
/>
|
|
104
|
+
))(ancestry)}
|
|
87
105
|
<StructureCrumb
|
|
88
|
-
name={name}
|
|
106
|
+
name={_.defaultTo(name)(alias)}
|
|
89
107
|
id={id}
|
|
90
108
|
version={version}
|
|
91
|
-
published_note={published_note}
|
|
92
109
|
/>
|
|
93
|
-
{
|
|
110
|
+
{_.isNil(version) ? null : <VersionCrumb id={id} version={version} />}
|
|
94
111
|
</Breadcrumb>
|
|
95
112
|
) : null;
|
|
96
113
|
|
|
@@ -98,10 +115,10 @@ StructureCrumbs.propTypes = {
|
|
|
98
115
|
ancestry: PropTypes.array,
|
|
99
116
|
id: PropTypes.number,
|
|
100
117
|
name: PropTypes.string,
|
|
118
|
+
alias: PropTypes.string,
|
|
101
119
|
field: PropTypes.object,
|
|
102
120
|
system: PropTypes.object,
|
|
103
|
-
version: PropTypes.string,
|
|
104
|
-
published_note: PropTypes.object,
|
|
121
|
+
version: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
105
122
|
};
|
|
106
123
|
|
|
107
124
|
const mapStateToProps = ({
|
|
@@ -115,4 +132,5 @@ const mapStateToProps = ({
|
|
|
115
132
|
system,
|
|
116
133
|
version,
|
|
117
134
|
});
|
|
135
|
+
|
|
118
136
|
export default connect(mapStateToProps)(StructureCrumbs);
|
|
@@ -4,20 +4,22 @@ import { Table } from "semantic-ui-react";
|
|
|
4
4
|
import { columnDecorator } from "@truedat/core/services";
|
|
5
5
|
|
|
6
6
|
export const StructureFieldRow = ({ field, columns }) => (
|
|
7
|
-
<Table.Row key={field.data_structure_id} warning={field.deleted_at
|
|
8
|
-
{columns
|
|
9
|
-
columns.map((column, key) => (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
<Table.Row key={field.data_structure_id} warning={!!field.deleted_at}>
|
|
8
|
+
{columns
|
|
9
|
+
? columns.map((column, key) => (
|
|
10
|
+
<Table.Cell
|
|
11
|
+
key={key}
|
|
12
|
+
textAlign={column.textAlign}
|
|
13
|
+
content={columnDecorator(column)(field)}
|
|
14
|
+
/>
|
|
15
|
+
))
|
|
16
|
+
: null}
|
|
16
17
|
</Table.Row>
|
|
17
18
|
);
|
|
18
19
|
|
|
19
20
|
StructureFieldRow.propTypes = {
|
|
20
|
-
|
|
21
|
+
field: PropTypes.object.isRequired,
|
|
22
|
+
columns: PropTypes.array,
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
export default StructureFieldRow;
|
|
@@ -4,15 +4,15 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Table } from "semantic-ui-react";
|
|
6
6
|
import { FormattedMessage } from "react-intl";
|
|
7
|
+
import { columnPredicate } from "@truedat/core/services";
|
|
7
8
|
import { getSortedFields, getStructureFieldColumns } from "../selectors";
|
|
8
9
|
import StructureFieldRow from "./StructureFieldRow";
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
c === "
|
|
11
|
+
const columnPred = (c) =>
|
|
12
|
+
c?.name === "degree" ? _.prop("degree") : columnPredicate(c);
|
|
12
13
|
|
|
13
|
-
const getColumns = (
|
|
14
|
-
|
|
15
|
-
};
|
|
14
|
+
const getColumns = (columns, fields) =>
|
|
15
|
+
_.filter((c) => _.any(columnPred(c))(fields))(columns);
|
|
16
16
|
|
|
17
17
|
export const StructureFields = ({ columns, fields, ...rest }) => (
|
|
18
18
|
<Table>
|
|
@@ -38,7 +38,7 @@ export const StructureFields = ({ columns, fields, ...rest }) => (
|
|
|
38
38
|
StructureFields.propTypes = {
|
|
39
39
|
columns: PropTypes.array,
|
|
40
40
|
fields: PropTypes.array,
|
|
41
|
-
version: PropTypes.string
|
|
41
|
+
version: PropTypes.string,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const mapStateToProps = (state, ownProps) => ({
|
|
@@ -48,7 +48,7 @@ const mapStateToProps = (state, ownProps) => ({
|
|
|
48
48
|
columns: getColumns(
|
|
49
49
|
_.propOr(getStructureFieldColumns(state), "columns")(ownProps),
|
|
50
50
|
state.structureFields
|
|
51
|
-
)
|
|
51
|
+
),
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
export default connect(mapStateToProps)(StructureFields);
|
|
@@ -49,14 +49,14 @@ StructureItem.propTypes = {
|
|
|
49
49
|
|
|
50
50
|
export const mapStateToProps = (
|
|
51
51
|
{ structure },
|
|
52
|
-
{ data_structure_id, id: structureId, type, name,
|
|
52
|
+
{ data_structure_id, id: structureId, type, name, alias }
|
|
53
53
|
) => {
|
|
54
54
|
const id = data_structure_id || structureId;
|
|
55
55
|
return {
|
|
56
56
|
id: id,
|
|
57
57
|
active:
|
|
58
58
|
type !== "system" && _.isFinite(id) && _.propEq("id", id)(structure),
|
|
59
|
-
name: _.
|
|
59
|
+
name: _.defaultTo(name)(alias),
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
|
|
@@ -55,7 +55,7 @@ export const StructureSummary = ({
|
|
|
55
55
|
class: structureClass,
|
|
56
56
|
classes: structureClasses,
|
|
57
57
|
name,
|
|
58
|
-
|
|
58
|
+
alias,
|
|
59
59
|
description,
|
|
60
60
|
userPermissions,
|
|
61
61
|
updatedAt,
|
|
@@ -75,13 +75,11 @@ export const StructureSummary = ({
|
|
|
75
75
|
<Dimmer.Dimmable dimmed={linkedStructureTagsLoading}>
|
|
76
76
|
<Header as="h2">
|
|
77
77
|
<Header.Content>
|
|
78
|
-
{_.
|
|
79
|
-
? name
|
|
80
|
-
: published_note.alias}
|
|
78
|
+
{_.defaultTo(name)(alias)}
|
|
81
79
|
{structureClasses?._grantable ? (
|
|
82
80
|
<StructureGrantButton />
|
|
83
81
|
) : null}
|
|
84
|
-
{
|
|
82
|
+
{_.isEmpty(alias) ? null : (
|
|
85
83
|
<Header.Subheader>{name}</Header.Subheader>
|
|
86
84
|
)}
|
|
87
85
|
</Header.Content>
|
|
@@ -120,7 +118,7 @@ StructureSummary.propTypes = {
|
|
|
120
118
|
class: PropTypes.string,
|
|
121
119
|
classes: PropTypes.object,
|
|
122
120
|
name: PropTypes.string,
|
|
123
|
-
|
|
121
|
+
alias: PropTypes.string,
|
|
124
122
|
description: PropTypes.string,
|
|
125
123
|
userPermissions: PropTypes.object,
|
|
126
124
|
updatedAt: PropTypes.string,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
3
|
import { StructureFieldRow } from "../StructureFieldRow";
|
|
4
4
|
import { defaultStructureFieldColumns } from "../../selectors/getStructureFieldColumns";
|
|
5
5
|
|
|
@@ -9,21 +9,30 @@ describe("<StructureFieldRow />", () => {
|
|
|
9
9
|
data_structure_id: 1,
|
|
10
10
|
name: "f1",
|
|
11
11
|
description: "dd",
|
|
12
|
-
type: "tp",
|
|
13
12
|
structureId: 123,
|
|
14
|
-
nullable: true,
|
|
15
|
-
precision: "22",
|
|
16
13
|
version: 12,
|
|
17
14
|
links: [
|
|
18
15
|
{ business_concept_version_id: 1, name: "foo", resource_id: 1 },
|
|
19
|
-
{ business_concept_version_id: 2, name: "Bar", resource_id: 2 }
|
|
20
|
-
]
|
|
16
|
+
{ business_concept_version_id: 2, name: "Bar", resource_id: 2 },
|
|
17
|
+
],
|
|
18
|
+
metadata: {
|
|
19
|
+
type: "tp",
|
|
20
|
+
nullable: true,
|
|
21
|
+
precision: "22",
|
|
22
|
+
},
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
const
|
|
24
|
-
<
|
|
25
|
+
const { container } = render(
|
|
26
|
+
<table>
|
|
27
|
+
<tbody>
|
|
28
|
+
<StructureFieldRow
|
|
29
|
+
field={field}
|
|
30
|
+
columns={defaultStructureFieldColumns}
|
|
31
|
+
/>
|
|
32
|
+
</tbody>
|
|
33
|
+
</table>
|
|
25
34
|
);
|
|
26
|
-
expect(
|
|
35
|
+
expect(container).toMatchSnapshot();
|
|
27
36
|
});
|
|
28
37
|
|
|
29
38
|
it("row prints column fields", () => {
|
|
@@ -31,37 +40,32 @@ describe("<StructureFieldRow />", () => {
|
|
|
31
40
|
data_structure_id: 1,
|
|
32
41
|
name: "f1",
|
|
33
42
|
description: "dd",
|
|
34
|
-
type: "tp",
|
|
35
43
|
structureId: 123,
|
|
36
|
-
nullable: true,
|
|
37
|
-
precision: "22",
|
|
38
44
|
version: 12,
|
|
39
45
|
links: [
|
|
40
46
|
{ business_concept_version_id: 1, name: "foo", resource_id: 1 },
|
|
41
|
-
{ business_concept_version_id: 2, name: "Bar", resource_id: 2 }
|
|
42
|
-
]
|
|
47
|
+
{ business_concept_version_id: 2, name: "Bar", resource_id: 2 },
|
|
48
|
+
],
|
|
49
|
+
metadata: {
|
|
50
|
+
nullable: true,
|
|
51
|
+
precision: "22",
|
|
52
|
+
type: "tp",
|
|
53
|
+
},
|
|
43
54
|
};
|
|
44
55
|
|
|
45
|
-
const
|
|
46
|
-
<
|
|
56
|
+
const { getAllByRole, getByText } = render(
|
|
57
|
+
<table>
|
|
58
|
+
<tbody>
|
|
59
|
+
<StructureFieldRow
|
|
60
|
+
field={field}
|
|
61
|
+
columns={defaultStructureFieldColumns}
|
|
62
|
+
/>
|
|
63
|
+
</tbody>
|
|
64
|
+
</table>
|
|
47
65
|
);
|
|
48
66
|
|
|
49
|
-
expect(
|
|
50
|
-
|
|
51
|
-
expect(
|
|
52
|
-
wrapper
|
|
53
|
-
.find("TableCell")
|
|
54
|
-
.at(0)
|
|
55
|
-
.dive()
|
|
56
|
-
.find("Link")
|
|
57
|
-
.props().children
|
|
58
|
-
).toEqual("f1");
|
|
59
|
-
|
|
60
|
-
const links = wrapper
|
|
61
|
-
.find("TableCell")
|
|
62
|
-
.at(7)
|
|
63
|
-
.dive()
|
|
64
|
-
.find("Link");
|
|
65
|
-
expect(links).toHaveLength(2);
|
|
67
|
+
expect(getAllByRole("cell")).toHaveLength(8);
|
|
68
|
+
expect(getByText("f1")).toBeDefined();
|
|
69
|
+
expect(getAllByRole("link")).toHaveLength(3);
|
|
66
70
|
});
|
|
67
71
|
});
|
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
1
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import StructureFields from "../StructureFields";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"name",
|
|
9
|
-
"type",
|
|
10
|
-
"precision",
|
|
11
|
-
"nullable",
|
|
12
|
-
"description",
|
|
13
|
-
"external_id",
|
|
14
|
-
"links"
|
|
15
|
-
]);
|
|
16
|
-
const fields = [
|
|
5
|
+
const state = {
|
|
6
|
+
structureFields: [
|
|
17
7
|
{
|
|
18
8
|
id: 123,
|
|
9
|
+
data_structure_id: 1,
|
|
19
10
|
name: "field1",
|
|
20
11
|
description: "desc1",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
links: [{ resource_id: 123 }],
|
|
13
|
+
metadata: {
|
|
14
|
+
nullable: true,
|
|
15
|
+
precision: "22",
|
|
16
|
+
type: "varchar",
|
|
17
|
+
},
|
|
25
18
|
},
|
|
26
19
|
{
|
|
27
20
|
id: 122,
|
|
21
|
+
data_structure_id: 2,
|
|
28
22
|
name: "field2",
|
|
29
23
|
description: "desc2",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
external_id: "foo",
|
|
25
|
+
metadata: {
|
|
26
|
+
nullable: true,
|
|
27
|
+
precision: "22",
|
|
28
|
+
type: "varchar",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
36
33
|
|
|
34
|
+
const renderOpts = { state };
|
|
35
|
+
|
|
36
|
+
describe("<StructureFields />", () => {
|
|
37
37
|
it("matches the latest snapshot", () => {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
expect(wrapper).toMatchSnapshot();
|
|
38
|
+
const { container } = render(<StructureFields />, renderOpts);
|
|
39
|
+
expect(container).toMatchSnapshot();
|
|
41
40
|
});
|
|
42
41
|
});
|
|
@@ -35,7 +35,7 @@ describe("<StructureItem />", () => {
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
it("matches the latest snapshot with alias", () => {
|
|
38
|
-
const props = { id, name,
|
|
38
|
+
const props = { id, name, alias: "alias" };
|
|
39
39
|
|
|
40
40
|
const { container } = render(<DefaultStructureItem {...props} />);
|
|
41
41
|
expect(container).toMatchSnapshot();
|
|
@@ -12,9 +12,7 @@ describe("<StructureItems />", () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it("matches the latest snapshot with alias", () => {
|
|
15
|
-
const structures = [
|
|
16
|
-
{ id: 1, name: "some structure", published_note: { alias: "alias" } },
|
|
17
|
-
];
|
|
15
|
+
const structures = [{ id: 1, name: "some structure", alias: "alias" }];
|
|
18
16
|
const props = { structures };
|
|
19
17
|
|
|
20
18
|
const { container } = render(<StructureItems {...props} />);
|
|
@@ -36,10 +36,7 @@ describe("<StructureSummary />", () => {
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
it("matches the latest snapshot with alias", () => {
|
|
39
|
-
const customState = _.set("structure.
|
|
40
|
-
alias: "some alias",
|
|
41
|
-
})(state);
|
|
42
|
-
|
|
39
|
+
const customState = _.set("structure.alias", "some alias")(state);
|
|
43
40
|
const { container } = render(<StructureSummary />, { state: customState });
|
|
44
41
|
expect(container).toMatchSnapshot();
|
|
45
42
|
});
|