@truedat/bg 8.5.9 → 8.6.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.
- package/package.json +3 -3
- package/src/concepts/components/ConceptDetails.js +2 -1
- package/src/concepts/components/__tests__/Concept.spec.js +22 -22
- package/src/concepts/components/__tests__/ConceptDetails.spec.js +13 -17
- package/src/concepts/components/__tests__/__snapshots__/ConceptDetails.spec.js.snap +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.1",
|
|
4
4
|
"description": "Truedat Web Business Glossary",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@testing-library/jest-dom": "^6.6.3",
|
|
55
55
|
"@testing-library/react": "^16.3.0",
|
|
56
56
|
"@testing-library/user-event": "^14.6.1",
|
|
57
|
-
"@truedat/test": "8.
|
|
57
|
+
"@truedat/test": "8.6.1",
|
|
58
58
|
"identity-obj-proxy": "^3.0.0",
|
|
59
59
|
"jest": "^29.7.0",
|
|
60
60
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
88
88
|
"swr": "^2.3.3"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "932eb0895ec71961f52a09309b99ae017977a899"
|
|
91
91
|
}
|
|
@@ -13,7 +13,8 @@ export const ConceptDetails = ({ concept, selectedContent, lang }) => {
|
|
|
13
13
|
<Segment attached="bottom">
|
|
14
14
|
<I18nProvider lang={lang}>
|
|
15
15
|
<DynamicFormViewer
|
|
16
|
-
template={concept.
|
|
16
|
+
template={concept.type}
|
|
17
|
+
domainIds={concept.domain?.id ? [concept.domain.id] : undefined}
|
|
17
18
|
content={selectedContent}
|
|
18
19
|
/>
|
|
19
20
|
</I18nProvider>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { render, waitForLoad } from "@truedat/test/render";
|
|
2
|
+
import { useTemplate } from "@truedat/core/hooks";
|
|
2
3
|
import { LangProviderWrapper } from "@truedat/core/i18n";
|
|
3
4
|
import { Concept } from "../Concept";
|
|
4
5
|
import ConceptContextProvider, { useConceptContext } from "../ConceptContext";
|
|
@@ -19,14 +20,24 @@ jest.mock("@truedat/core/hooks", () => {
|
|
|
19
20
|
return {
|
|
20
21
|
__esModule: true,
|
|
21
22
|
...originalModule,
|
|
22
|
-
useOperators: () => ({
|
|
23
|
+
useOperators: jest.fn(() => ({
|
|
23
24
|
data: {},
|
|
24
25
|
error: false,
|
|
25
26
|
loading: false,
|
|
26
|
-
}),
|
|
27
|
+
})),
|
|
28
|
+
useTemplate: jest.fn(),
|
|
27
29
|
};
|
|
28
30
|
});
|
|
29
31
|
|
|
32
|
+
const template = {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
name: "foo_group",
|
|
36
|
+
fields: [{ name: "field", label: "field_label", values: ["value1"] }],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
|
|
30
41
|
const renderOpts = {
|
|
31
42
|
state: {
|
|
32
43
|
concept: {
|
|
@@ -36,16 +47,7 @@ const renderOpts = {
|
|
|
36
47
|
type: "type",
|
|
37
48
|
status: "draft",
|
|
38
49
|
last_change_at: "2025-01-01T10:00:00Z",
|
|
39
|
-
template
|
|
40
|
-
content: [
|
|
41
|
-
{
|
|
42
|
-
name: "foo_group",
|
|
43
|
-
fields: [
|
|
44
|
-
{ name: "field", label: "field_label", values: ["value1"] },
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
},
|
|
50
|
+
template,
|
|
49
51
|
i18n_content: {
|
|
50
52
|
es: {
|
|
51
53
|
field: "field_label",
|
|
@@ -81,16 +83,7 @@ describe("<Concept />", () => {
|
|
|
81
83
|
type: "type",
|
|
82
84
|
status: "draft",
|
|
83
85
|
last_change_at: "2024-01-01T10:00:00Z",
|
|
84
|
-
template
|
|
85
|
-
content: [
|
|
86
|
-
{
|
|
87
|
-
name: "foo_group",
|
|
88
|
-
fields: [
|
|
89
|
-
{ name: "field", label: "field_label", values: ["value1"] },
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
86
|
+
template,
|
|
94
87
|
i18n_content: {
|
|
95
88
|
es: {
|
|
96
89
|
field: "field_label",
|
|
@@ -111,6 +104,13 @@ describe("<Concept />", () => {
|
|
|
111
104
|
},
|
|
112
105
|
};
|
|
113
106
|
|
|
107
|
+
beforeEach(() => {
|
|
108
|
+
useTemplate.mockReturnValue({
|
|
109
|
+
data: { template },
|
|
110
|
+
loading: false,
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
114
|
it("matches the latest snapshot", async () => {
|
|
115
115
|
useConceptContext.mockReturnValue({
|
|
116
116
|
conceptContext: { grantView: false },
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
import { render } from "@truedat/test/render";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
2
|
+
import { templateByNameMock } from "@truedat/test/mocks";
|
|
2
3
|
import { ConceptDetails } from "../ConceptDetails";
|
|
3
4
|
|
|
4
5
|
describe("<ConceptDetails />", () => {
|
|
5
6
|
const props = {
|
|
6
7
|
concept: {
|
|
7
8
|
name: "Concept1",
|
|
8
|
-
type: "
|
|
9
|
+
type: "template1",
|
|
9
10
|
status: "draft",
|
|
10
|
-
|
|
11
|
-
content: [
|
|
12
|
-
{
|
|
13
|
-
name: "foo_group",
|
|
14
|
-
fields: [
|
|
15
|
-
{ name: "field", label: "field_label", values: ["value1"] },
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
},
|
|
11
|
+
domain: { id: 1 },
|
|
20
12
|
dynamic_content: {
|
|
21
|
-
|
|
13
|
+
field1: { value: "value1", origin: "user" },
|
|
22
14
|
},
|
|
23
15
|
},
|
|
24
|
-
selectedContent: {
|
|
16
|
+
selectedContent: { field1: { value: "value1", origin: "user" } },
|
|
25
17
|
lang: "en",
|
|
26
18
|
};
|
|
27
19
|
|
|
28
20
|
it("matches the latest snapshot", async () => {
|
|
29
|
-
const
|
|
21
|
+
const renderOpts = {
|
|
22
|
+
mocks: [templateByNameMock({ name: "template1", domainIds: [1] })],
|
|
23
|
+
};
|
|
24
|
+
const rendered = render(<ConceptDetails {...props} />, renderOpts);
|
|
25
|
+
await waitForLoad(rendered);
|
|
30
26
|
|
|
31
|
-
await findByText(
|
|
32
|
-
expect(container).toMatchSnapshot();
|
|
27
|
+
await rendered.findByText(/field1/i);
|
|
28
|
+
expect(rendered.container).toMatchSnapshot();
|
|
33
29
|
});
|
|
34
30
|
});
|
|
@@ -9,7 +9,7 @@ exports[`<ConceptDetails /> matches the latest snapshot 1`] = `
|
|
|
9
9
|
class="ui horizontal divider"
|
|
10
10
|
>
|
|
11
11
|
<h3>
|
|
12
|
-
|
|
12
|
+
g1
|
|
13
13
|
</h3>
|
|
14
14
|
</div>
|
|
15
15
|
<div
|
|
@@ -23,7 +23,7 @@ exports[`<ConceptDetails /> matches the latest snapshot 1`] = `
|
|
|
23
23
|
<div
|
|
24
24
|
class="header dynamic-field-header"
|
|
25
25
|
>
|
|
26
|
-
|
|
26
|
+
field1
|
|
27
27
|
</div>
|
|
28
28
|
<div
|
|
29
29
|
class="description"
|