@truedat/core 4.44.2 → 4.44.5
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 +13 -0
- package/package.json +24 -18
- package/src/api/queries.js +12 -0
- package/src/components/CatalogMenu.js +4 -3
- package/src/components/DashboardMenu.js +12 -4
- package/src/components/QualityMenu.js +15 -7
- package/src/components/SideMenu.js +11 -5
- package/src/components/SidebarToggle.js +9 -4
- package/src/components/Submenu.js +12 -10
- package/src/components/TemplateSelector.js +99 -0
- package/src/components/__tests__/DashboardMenu.spec.js +13 -14
- package/src/components/__tests__/DateTime.spec.js +5 -3
- package/src/components/__tests__/QualityMenu.spec.js +14 -14
- package/src/components/__tests__/SideMenu.spec.js +7 -14
- package/src/components/__tests__/Submenu.spec.js +7 -19
- package/src/components/__tests__/TemplateSelector.spec.js +80 -0
- package/src/components/__tests__/__snapshots__/AdminMenu.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/CatalogMenu.spec.js.snap +13 -0
- package/src/components/__tests__/__snapshots__/DashboardMenu.spec.js.snap +1 -16
- package/src/components/__tests__/__snapshots__/DateTime.spec.js.snap +7 -19
- package/src/components/__tests__/__snapshots__/GlossaryMenu.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/GrantMenu.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/IngestMenu.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/LineageMenu.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/MembersMenu.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/QualityMenu.spec.js.snap +60 -26
- package/src/components/__tests__/__snapshots__/SearchMenu.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/SideMenu.spec.js.snap +58 -30
- package/src/components/__tests__/__snapshots__/Submenu.spec.js.snap +30 -38
- package/src/components/__tests__/__snapshots__/TaxonomyMenu.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/TemplateSelector.spec.js.snap +210 -0
- package/src/components/index.js +2 -0
- package/src/messages/en.js +6 -0
- package/src/messages/es.js +6 -0
- package/src/routes.js +21 -18
- package/src/services/file.js +9 -0
- package/src/services/sort.js +2 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { waitForElementToBeRemoved } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import { render } from "@truedat/test/render";
|
|
5
|
+
import {
|
|
6
|
+
errorTemplateMock,
|
|
7
|
+
multipleTemplatesMock,
|
|
8
|
+
singleTemplateMock,
|
|
9
|
+
} from "@truedat/test/mocks";
|
|
10
|
+
import TemplateSelector from "../TemplateSelector";
|
|
11
|
+
|
|
12
|
+
const scope = "foo";
|
|
13
|
+
const domainIds = [1];
|
|
14
|
+
const variables = { scope, domainIds };
|
|
15
|
+
|
|
16
|
+
describe("<TemplateSelector />", () => {
|
|
17
|
+
const onChange = jest.fn();
|
|
18
|
+
const props = { onChange, domainIds, scope };
|
|
19
|
+
|
|
20
|
+
it("matches the latest snapshot (loading)", () => {
|
|
21
|
+
const renderOpts = { mocks: [multipleTemplatesMock(variables)] };
|
|
22
|
+
const { container, queryByText } = render(
|
|
23
|
+
<TemplateSelector {...props} />,
|
|
24
|
+
renderOpts
|
|
25
|
+
);
|
|
26
|
+
expect(queryByText(/loading/i)).toBeInTheDocument();
|
|
27
|
+
expect(container).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("matches the latest snapshot", async () => {
|
|
31
|
+
const renderOpts = { mocks: [multipleTemplatesMock(variables)] };
|
|
32
|
+
const onLoad = jest.fn();
|
|
33
|
+
const { container, queryByText } = render(
|
|
34
|
+
<TemplateSelector {...props} onLoad={onLoad} />,
|
|
35
|
+
renderOpts
|
|
36
|
+
);
|
|
37
|
+
await waitForElementToBeRemoved(() => queryByText(/loading/i));
|
|
38
|
+
expect(queryByText("template1")).toBeInTheDocument();
|
|
39
|
+
expect(container).toMatchSnapshot();
|
|
40
|
+
expect(onLoad.mock.calls.length).toBe(1);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("matches the latest snapshot when required", async () => {
|
|
44
|
+
const renderOpts = { mocks: [multipleTemplatesMock(variables)] };
|
|
45
|
+
const { container, queryByText } = render(
|
|
46
|
+
<TemplateSelector {...props} required />,
|
|
47
|
+
renderOpts
|
|
48
|
+
);
|
|
49
|
+
await waitForElementToBeRemoved(() => queryByText(/loading/i));
|
|
50
|
+
expect(queryByText("template1")).toBeInTheDocument();
|
|
51
|
+
expect(container).toMatchSnapshot();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("is empty if templates query returns an error", async () => {
|
|
55
|
+
const renderOpts = { mocks: [errorTemplateMock(variables)] };
|
|
56
|
+
const { queryByText } = render(
|
|
57
|
+
<TemplateSelector {...props} required />,
|
|
58
|
+
renderOpts
|
|
59
|
+
);
|
|
60
|
+
await waitForElementToBeRemoved(() => queryByText(/loading/i));
|
|
61
|
+
expect(queryByText("template1")).not.toBeInTheDocument();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("calls onChange when template is selected", async () => {
|
|
65
|
+
const renderOpts = { mocks: [multipleTemplatesMock(variables)] };
|
|
66
|
+
const { findByRole } = render(<TemplateSelector {...props} />, renderOpts);
|
|
67
|
+
|
|
68
|
+
userEvent.click(await findByRole("option", { name: "template1" }));
|
|
69
|
+
expect(onChange.mock.calls[0][1]).toMatchObject({
|
|
70
|
+
template: { id: "1", label: "template1" },
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("is empty when query returns a single template", async () => {
|
|
75
|
+
const renderOpts = { mocks: [singleTemplateMock(variables)] };
|
|
76
|
+
const { queryByText } = render(<TemplateSelector {...props} />, renderOpts);
|
|
77
|
+
await waitForElementToBeRemoved(() => queryByText(/loading/i));
|
|
78
|
+
expect(queryByText("template1")).not.toBeInTheDocument();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -68,6 +68,19 @@ exports[`<CatalogMenu /> matches the latest snapshot 1`] = `
|
|
|
68
68
|
structureTags
|
|
69
69
|
</span>
|
|
70
70
|
</a>
|
|
71
|
+
<a
|
|
72
|
+
aria-checked="false"
|
|
73
|
+
class="item"
|
|
74
|
+
href="/referenceDatasets"
|
|
75
|
+
name="referenceData"
|
|
76
|
+
role="option"
|
|
77
|
+
>
|
|
78
|
+
<span
|
|
79
|
+
class="text"
|
|
80
|
+
>
|
|
81
|
+
referenceData
|
|
82
|
+
</span>
|
|
83
|
+
</a>
|
|
71
84
|
<a
|
|
72
85
|
aria-checked="false"
|
|
73
86
|
class="item"
|
|
@@ -1,18 +1,3 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<DashboardMenu /> matches the latest snapshot 1`] =
|
|
4
|
-
<Submenu
|
|
5
|
-
icon="chart line"
|
|
6
|
-
items={
|
|
7
|
-
Array [
|
|
8
|
-
Object {
|
|
9
|
-
"name": "dashboard",
|
|
10
|
-
"routes": Array [
|
|
11
|
-
"/dashboard",
|
|
12
|
-
],
|
|
13
|
-
},
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
name="dashboard"
|
|
17
|
-
/>
|
|
18
|
-
`;
|
|
3
|
+
exports[`<DashboardMenu /> matches the latest snapshot 1`] = `<div />`;
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<DateTime /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
format="YYYY-MM-DD HH:mm"
|
|
12
|
-
fromNow={false}
|
|
13
|
-
interval={60000}
|
|
14
|
-
local={false}
|
|
15
|
-
onChange={[Function]}
|
|
16
|
-
titleFormat=""
|
|
17
|
-
toNow={false}
|
|
18
|
-
unit={null}
|
|
19
|
-
unix={false}
|
|
20
|
-
utc={false}
|
|
21
|
-
withTitle={false}
|
|
22
|
-
/>
|
|
4
|
+
<div>
|
|
5
|
+
<time
|
|
6
|
+
datetime="1530084773154"
|
|
7
|
+
>
|
|
8
|
+
2018-06-27 07:32
|
|
9
|
+
</time>
|
|
10
|
+
</div>
|
|
23
11
|
`;
|
|
@@ -1,30 +1,64 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<QualityMenu /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
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
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="active"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
aria-expanded="false"
|
|
10
|
+
class="ui item dropdown active"
|
|
11
|
+
role="listbox"
|
|
12
|
+
tabindex="0"
|
|
13
|
+
>
|
|
14
|
+
<a
|
|
15
|
+
class="ui"
|
|
16
|
+
href="/rules"
|
|
17
|
+
>
|
|
18
|
+
<i
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
class="check square large icon"
|
|
21
|
+
/>
|
|
22
|
+
</a>
|
|
23
|
+
<div
|
|
24
|
+
class="menu transition"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
class="header selectable"
|
|
28
|
+
>
|
|
29
|
+
Data Quality
|
|
30
|
+
</div>
|
|
31
|
+
<div
|
|
32
|
+
class="divider"
|
|
33
|
+
/>
|
|
34
|
+
<a
|
|
35
|
+
aria-checked="true"
|
|
36
|
+
class="active item"
|
|
37
|
+
href="/rules"
|
|
38
|
+
name="rules"
|
|
39
|
+
role="option"
|
|
40
|
+
>
|
|
41
|
+
<span
|
|
42
|
+
class="text"
|
|
43
|
+
>
|
|
44
|
+
Quality Rules
|
|
45
|
+
</span>
|
|
46
|
+
</a>
|
|
47
|
+
<a
|
|
48
|
+
aria-checked="true"
|
|
49
|
+
class="active item"
|
|
50
|
+
href="/implementations"
|
|
51
|
+
name="implementations"
|
|
52
|
+
role="option"
|
|
53
|
+
>
|
|
54
|
+
<span
|
|
55
|
+
class="text"
|
|
56
|
+
>
|
|
57
|
+
Implementations
|
|
58
|
+
</span>
|
|
59
|
+
</a>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
30
64
|
`;
|
|
@@ -1,38 +1,66 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<SideMenu /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
as={[Function]}
|
|
8
|
-
direction="left"
|
|
9
|
-
icon={false}
|
|
10
|
-
target={null}
|
|
11
|
-
vertical={true}
|
|
12
|
-
visible={true}
|
|
13
|
-
width={null}
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="pushable"
|
|
14
7
|
>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
<div
|
|
9
|
+
class="ui vertical ui push left visible sidebar menu"
|
|
10
|
+
>
|
|
11
|
+
<div>
|
|
12
|
+
<div
|
|
13
|
+
aria-expanded="false"
|
|
14
|
+
class="ui item dropdown"
|
|
15
|
+
role="listbox"
|
|
16
|
+
tabindex="0"
|
|
17
|
+
>
|
|
18
|
+
<a
|
|
19
|
+
class="ui"
|
|
20
|
+
href="/search"
|
|
21
|
+
>
|
|
22
|
+
<i
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
class="search large icon"
|
|
25
|
+
/>
|
|
26
|
+
Search
|
|
27
|
+
</a>
|
|
28
|
+
<div
|
|
29
|
+
class="menu transition"
|
|
30
|
+
>
|
|
31
|
+
<a
|
|
32
|
+
aria-checked="false"
|
|
33
|
+
class="item"
|
|
34
|
+
href="/search"
|
|
35
|
+
name="search"
|
|
36
|
+
role="option"
|
|
37
|
+
>
|
|
38
|
+
<span
|
|
39
|
+
class="text"
|
|
40
|
+
>
|
|
41
|
+
Search
|
|
42
|
+
</span>
|
|
43
|
+
</a>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<a
|
|
48
|
+
class="item bottom"
|
|
49
|
+
>
|
|
50
|
+
<i
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
class="angle double left large icon"
|
|
53
|
+
/>
|
|
54
|
+
Collapse sidebar
|
|
55
|
+
</a>
|
|
56
|
+
</div>
|
|
57
|
+
<div
|
|
58
|
+
class="pusher"
|
|
59
|
+
>
|
|
32
60
|
<p>
|
|
33
61
|
Hello
|
|
34
62
|
</p>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
38
66
|
`;
|
|
@@ -1,43 +1,35 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<Submenu /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
className="selectable"
|
|
8
|
-
onClick={[Function]}
|
|
9
|
-
>
|
|
10
|
-
<Link
|
|
11
|
-
to="/foo"
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="active item selectable"
|
|
12
7
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/>
|
|
41
|
-
</MenuMenu>
|
|
42
|
-
</MenuItem>
|
|
8
|
+
<a
|
|
9
|
+
href="/foo"
|
|
10
|
+
>
|
|
11
|
+
<i
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
class="large icon"
|
|
14
|
+
/>
|
|
15
|
+
foo
|
|
16
|
+
</a>
|
|
17
|
+
<div
|
|
18
|
+
class="menu"
|
|
19
|
+
>
|
|
20
|
+
<a
|
|
21
|
+
class="active link item"
|
|
22
|
+
href="/foo"
|
|
23
|
+
>
|
|
24
|
+
foo
|
|
25
|
+
</a>
|
|
26
|
+
<a
|
|
27
|
+
class="link item"
|
|
28
|
+
href="/baz"
|
|
29
|
+
>
|
|
30
|
+
baz
|
|
31
|
+
</a>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
43
35
|
`;
|