@truedat/bg 7.0.5 → 7.0.7
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 +6 -6
- package/src/concepts/components/DomainConcepts.js +1 -4
- package/src/concepts/components/__tests__/__snapshots__/ConceptForm.spec.js.snap +5 -5
- package/src/concepts/components/__tests__/__snapshots__/ConceptsBulkUpdate.spec.js.snap +5 -5
- package/src/concepts/components/__tests__/__snapshots__/SharedToForm.spec.js.snap +5 -5
- package/src/hooks/useDomains.js +77 -0
- package/src/messages/en.js +6 -0
- package/src/messages/es.js +5 -0
- package/src/reducers/index.js +0 -1
- package/src/taxonomy/components/AddDomainMember.js +1 -7
- package/src/taxonomy/components/Domain.js +80 -84
- package/src/taxonomy/components/DomainActions.js +57 -84
- package/src/taxonomy/components/DomainCrumbs.js +51 -43
- package/src/taxonomy/components/DomainDetail.js +88 -46
- package/src/taxonomy/components/DomainForm.js +34 -36
- package/src/taxonomy/components/DomainImplementations.js +1 -4
- package/src/taxonomy/components/DomainMembers.js +8 -1
- package/src/taxonomy/components/DomainRoutes.js +8 -55
- package/src/taxonomy/components/DomainStructures.js +1 -4
- package/src/taxonomy/components/DomainTabs.js +22 -29
- package/src/taxonomy/components/Domains.js +66 -27
- package/src/taxonomy/components/DomainsActions.js +5 -14
- package/src/taxonomy/components/EditDomain.js +35 -21
- package/src/taxonomy/components/NewDomain.js +47 -22
- package/src/taxonomy/components/__tests__/Domain.spec.js +17 -8
- package/src/taxonomy/components/__tests__/DomainActions.spec.js +62 -7
- package/src/taxonomy/components/__tests__/DomainCrumbs.spec.js +18 -5
- package/src/taxonomy/components/__tests__/DomainDetail.spec.js +87 -4
- package/src/taxonomy/components/__tests__/DomainForm.spec.js +189 -4
- package/src/taxonomy/components/__tests__/DomainMembers.spec.js +1 -3
- package/src/taxonomy/components/__tests__/DomainStructures.spec.js +3 -2
- package/src/taxonomy/components/__tests__/Domains.spec.js +103 -6
- package/src/taxonomy/components/__tests__/EditDomain.spec.js +56 -5
- package/src/taxonomy/components/__tests__/NewDomain.spec.js +65 -6
- package/src/taxonomy/components/__tests__/__snapshots__/AddDomainMember.spec.js.snap +0 -10
- package/src/taxonomy/components/__tests__/__snapshots__/Domain.spec.js.snap +35 -48
- package/src/taxonomy/components/__tests__/__snapshots__/DomainActions.spec.js.snap +56 -1
- package/src/taxonomy/components/__tests__/__snapshots__/DomainCrumbs.spec.js.snap +14 -2
- package/src/taxonomy/components/__tests__/__snapshots__/DomainDetail.spec.js.snap +93 -40
- package/src/taxonomy/components/__tests__/__snapshots__/DomainForm.spec.js.snap +7 -7
- package/src/taxonomy/components/__tests__/__snapshots__/Domains.spec.js.snap +75 -10
- package/src/taxonomy/components/__tests__/__snapshots__/DomainsActions.spec.js.snap +20 -1
- package/src/taxonomy/components/__tests__/__snapshots__/EditDomain.spec.js.snap +192 -30
- package/src/taxonomy/components/__tests__/__snapshots__/NewDomain.spec.js.snap +405 -28
- package/src/taxonomy/components/index.js +1 -2
- package/src/taxonomy/index.js +0 -1
- package/src/taxonomy/routines.js +0 -10
- package/src/taxonomy/sagas/index.js +2 -21
- package/src/taxonomy/selectors/getDomainsConcept.js +0 -13
- package/src/taxonomy/selectors/index.js +0 -16
- package/src/taxonomy/components/DomainCards.js +0 -97
- package/src/taxonomy/components/DomainLoader.js +0 -60
- package/src/taxonomy/components/DomainMembersLoader.js +0 -44
- package/src/taxonomy/components/DomainsLoader.js +0 -40
- package/src/taxonomy/components/__tests__/DomainCards.spec.js +0 -30
- package/src/taxonomy/components/__tests__/DomainsLoader.spec.js +0 -38
- package/src/taxonomy/components/__tests__/__snapshots__/DomainCards.spec.js.snap +0 -160
- package/src/taxonomy/reducers/__tests__/domain.spec.js +0 -58
- package/src/taxonomy/reducers/__tests__/domainConceptLoading.spec.js +0 -26
- package/src/taxonomy/reducers/__tests__/domainCreating.spec.js +0 -24
- package/src/taxonomy/reducers/__tests__/domainLoading.spec.js +0 -22
- package/src/taxonomy/reducers/__tests__/domainMembersActions.spec.js +0 -38
- package/src/taxonomy/reducers/__tests__/domainMembersLoading.spec.js +0 -26
- package/src/taxonomy/reducers/__tests__/domainRedirect.spec.js +0 -36
- package/src/taxonomy/reducers/__tests__/domainUpdating.spec.js +0 -24
- package/src/taxonomy/reducers/__tests__/domains.spec.js +0 -30
- package/src/taxonomy/reducers/__tests__/domainsActions.spec.js +0 -36
- package/src/taxonomy/reducers/__tests__/domainsConcept.spec.js +0 -30
- package/src/taxonomy/reducers/__tests__/domainsFilter.spec.js +0 -41
- package/src/taxonomy/reducers/__tests__/domainsLoading.spec.js +0 -22
- package/src/taxonomy/reducers/domain.js +0 -32
- package/src/taxonomy/reducers/domainActions.js +0 -19
- package/src/taxonomy/reducers/domainCreating.js +0 -14
- package/src/taxonomy/reducers/domainLoading.js +0 -14
- package/src/taxonomy/reducers/domainMembersActions.js +0 -22
- package/src/taxonomy/reducers/domainMembersLoading.js +0 -12
- package/src/taxonomy/reducers/domainRedirect.js +0 -25
- package/src/taxonomy/reducers/domainUpdating.js +0 -14
- package/src/taxonomy/reducers/domains.js +0 -19
- package/src/taxonomy/reducers/domainsActions.js +0 -20
- package/src/taxonomy/reducers/domainsConcept.js +0 -19
- package/src/taxonomy/reducers/domainsConceptLoading.js +0 -12
- package/src/taxonomy/reducers/domainsFilter.js +0 -24
- package/src/taxonomy/reducers/domainsLoading.js +0 -12
- package/src/taxonomy/reducers/index.js +0 -31
- package/src/taxonomy/sagas/__tests__/fetchDomain.spec.js +0 -69
- package/src/taxonomy/sagas/__tests__/fetchDomains.spec.js +0 -90
- package/src/taxonomy/sagas/createDomain.js +0 -27
- package/src/taxonomy/sagas/deleteDomain.js +0 -34
- package/src/taxonomy/sagas/fetchDomain.js +0 -30
- package/src/taxonomy/sagas/fetchDomains.js +0 -37
- package/src/taxonomy/sagas/updateDomain.js +0 -30
- package/src/taxonomy/selectors/__tests__/domainParentOptionsSelector.spec.js +0 -24
- package/src/taxonomy/selectors/__tests__/getDomainActions.spec.js +0 -46
- package/src/taxonomy/selectors/__tests__/getDomainGroups.spec.js +0 -17
- package/src/taxonomy/selectors/__tests__/getDomainTypes.spec.js +0 -14
- package/src/taxonomy/selectors/domainParentOptionsSelector.js +0 -12
- package/src/taxonomy/selectors/getDomainActions.js +0 -32
- package/src/taxonomy/selectors/getDomainGroups.js +0 -11
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { withRouter } from "react-router-dom";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { compose } from "redux";
|
|
5
|
-
import { connect } from "react-redux";
|
|
6
|
-
import { Loading } from "@truedat/core/components";
|
|
7
|
-
import { clearDomain, fetchDomain } from "../routines";
|
|
8
|
-
|
|
9
|
-
class DomainLoader extends React.Component {
|
|
10
|
-
static propTypes = {
|
|
11
|
-
fetchDomain: PropTypes.func,
|
|
12
|
-
clearDomain: PropTypes.func,
|
|
13
|
-
match: PropTypes.object,
|
|
14
|
-
domainLoading: PropTypes.bool,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
componentDidMount() {
|
|
18
|
-
const { clearDomain, fetchDomain, match } = this.props;
|
|
19
|
-
const { id } = match.params;
|
|
20
|
-
if (id) {
|
|
21
|
-
fetchDomain({ id });
|
|
22
|
-
} else {
|
|
23
|
-
clearDomain();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
componentDidUpdate(prevProps) {
|
|
28
|
-
const { clearDomain, fetchDomain, match } = this.props;
|
|
29
|
-
const { id } = match.params;
|
|
30
|
-
if (prevProps.match.params.id !== id) {
|
|
31
|
-
if (id) {
|
|
32
|
-
fetchDomain({ id });
|
|
33
|
-
} else {
|
|
34
|
-
clearDomain();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
componentWillUnmount() {
|
|
40
|
-
const { clearDomain } = this.props;
|
|
41
|
-
clearDomain();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
render() {
|
|
45
|
-
const { domainLoading } = this.props;
|
|
46
|
-
|
|
47
|
-
if (domainLoading) {
|
|
48
|
-
return <Loading />;
|
|
49
|
-
} else {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const mapStateToProps = ({ domainLoading }) => ({ domainLoading });
|
|
56
|
-
|
|
57
|
-
export default compose(
|
|
58
|
-
withRouter,
|
|
59
|
-
connect(mapStateToProps, { clearDomain, fetchDomain })
|
|
60
|
-
)(DomainLoader);
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { withRouter } from "react-router-dom";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { compose } from "redux";
|
|
5
|
-
import { connect } from "react-redux";
|
|
6
|
-
import { fetchDomainMembers } from "../routines";
|
|
7
|
-
|
|
8
|
-
class DomainMembersLoader extends React.Component {
|
|
9
|
-
static propTypes = {
|
|
10
|
-
fetchDomainMembers: PropTypes.func,
|
|
11
|
-
match: PropTypes.object,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
componentDidMount() {
|
|
15
|
-
const { fetchDomainMembers, match } = this.props;
|
|
16
|
-
const { id } = match.params;
|
|
17
|
-
if (id) {
|
|
18
|
-
fetchDomainMembers({ id });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
componentDidUpdate(prevProps) {
|
|
23
|
-
const { fetchDomainMembers, match } = this.props;
|
|
24
|
-
const { id } = match.params;
|
|
25
|
-
if (prevProps.match.params.id !== id) {
|
|
26
|
-
if (id) {
|
|
27
|
-
fetchDomainMembers({ id });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const mapStateToProps = ({ domainMembersLoading }) => ({
|
|
38
|
-
domainMembersLoading,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export default compose(
|
|
42
|
-
withRouter,
|
|
43
|
-
connect(mapStateToProps, { fetchDomainMembers })
|
|
44
|
-
)(DomainMembersLoader);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { connect } from "react-redux";
|
|
4
|
-
import { Loading } from "@truedat/core/components";
|
|
5
|
-
import { clearDomains, fetchDomains } from "../routines";
|
|
6
|
-
|
|
7
|
-
export class DomainsLoader extends React.Component {
|
|
8
|
-
static propTypes = {
|
|
9
|
-
actions: PropTypes.string,
|
|
10
|
-
clearDomains: PropTypes.func,
|
|
11
|
-
fetchDomains: PropTypes.func,
|
|
12
|
-
filter: PropTypes.string,
|
|
13
|
-
domainLoading: PropTypes.bool,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
componentDidMount() {
|
|
17
|
-
const { fetchDomains, actions, filter } = this.props;
|
|
18
|
-
fetchDomains({ actions, filter });
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
componentWillUnmount() {
|
|
22
|
-
const { clearDomains } = this.props;
|
|
23
|
-
clearDomains();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
render() {
|
|
27
|
-
const { domainLoading } = this.props;
|
|
28
|
-
if (domainLoading) {
|
|
29
|
-
return <Loading />;
|
|
30
|
-
} else {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const mapStateToProps = ({ domainLoading }) => ({ domainLoading });
|
|
37
|
-
|
|
38
|
-
export default connect(mapStateToProps, { clearDomains, fetchDomains })(
|
|
39
|
-
DomainsLoader
|
|
40
|
-
);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { shallow } from "enzyme";
|
|
3
|
-
import { intl } from "@truedat/test/intl-stub";
|
|
4
|
-
import { DomainCards } from "../DomainCards";
|
|
5
|
-
|
|
6
|
-
// workaround for enzyme issue with React.useContext
|
|
7
|
-
// see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
|
|
8
|
-
jest.spyOn(React, "useContext").mockImplementation(() => intl);
|
|
9
|
-
|
|
10
|
-
describe("<DomainCards />", () => {
|
|
11
|
-
const domainsFilter = "d";
|
|
12
|
-
|
|
13
|
-
it("matches the latest snapshot", () => {
|
|
14
|
-
const visibleDomains = [
|
|
15
|
-
{ id: 1, name: "domain1" },
|
|
16
|
-
{ id: 2, name: "domain2" }
|
|
17
|
-
];
|
|
18
|
-
const props = { visibleDomains, domainsFilter };
|
|
19
|
-
const wrapper = shallow(<DomainCards {...props} />);
|
|
20
|
-
expect(wrapper).toMatchSnapshot();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("matches the latest snapshot (no subdomains)", () => {
|
|
24
|
-
const domain = { id: 1 };
|
|
25
|
-
const visibleDomains = [];
|
|
26
|
-
const props = { domain, visibleDomains, domainsFilter };
|
|
27
|
-
const wrapper = shallow(<DomainCards {...props} />);
|
|
28
|
-
expect(wrapper).toMatchSnapshot();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { mount } from "enzyme";
|
|
3
|
-
import { DomainsLoader } from "../DomainsLoader";
|
|
4
|
-
|
|
5
|
-
const getProps = () => ({
|
|
6
|
-
clearDomains: jest.fn(),
|
|
7
|
-
domainsLoading: false,
|
|
8
|
-
fetchDomains: jest.fn(),
|
|
9
|
-
actions: "create_ingest",
|
|
10
|
-
filter: "all"
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
describe("<DomainsLoader />", () => {
|
|
14
|
-
it("calls fetchDomains when component mounts but not when it unmounts", () => {
|
|
15
|
-
const props = getProps();
|
|
16
|
-
const wrapper = mount(<DomainsLoader {...props} />);
|
|
17
|
-
expect(props.fetchDomains).toHaveBeenCalledTimes(1);
|
|
18
|
-
wrapper.unmount();
|
|
19
|
-
expect(props.fetchDomains).toHaveBeenCalledTimes(1);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("calls clearDomains and clearDomainDefaultFilters when component unmounts but not when it mounts", () => {
|
|
23
|
-
const props = getProps();
|
|
24
|
-
const wrapper = mount(<DomainsLoader {...props} />);
|
|
25
|
-
expect(props.clearDomains).toHaveBeenCalledTimes(0);
|
|
26
|
-
wrapper.unmount();
|
|
27
|
-
expect(props.clearDomains).toHaveBeenCalledTimes(1);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("renders Loading when domainLoading is true", () => {
|
|
31
|
-
const props = getProps();
|
|
32
|
-
|
|
33
|
-
const wrapper = mount(
|
|
34
|
-
<DomainsLoader {...{ ...props, domainLoading: true }} />
|
|
35
|
-
);
|
|
36
|
-
expect(wrapper.find("Loading").length).toBe(1);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<DomainCards /> matches the latest snapshot (no subdomains) 1`] = `
|
|
4
|
-
<Fragment>
|
|
5
|
-
<Divider
|
|
6
|
-
hidden={true}
|
|
7
|
-
/>
|
|
8
|
-
<Header
|
|
9
|
-
as="h4"
|
|
10
|
-
>
|
|
11
|
-
<Icon
|
|
12
|
-
as="i"
|
|
13
|
-
name="search"
|
|
14
|
-
/>
|
|
15
|
-
<HeaderContent>
|
|
16
|
-
<MemoizedFormattedMessage
|
|
17
|
-
id="domains.search.results.empty"
|
|
18
|
-
/>
|
|
19
|
-
</HeaderContent>
|
|
20
|
-
</Header>
|
|
21
|
-
<Message
|
|
22
|
-
header="domain.children.empty"
|
|
23
|
-
/>
|
|
24
|
-
<CardGroup />
|
|
25
|
-
</Fragment>
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
exports[`<DomainCards /> matches the latest snapshot 1`] = `
|
|
29
|
-
<Fragment>
|
|
30
|
-
<Divider
|
|
31
|
-
hidden={true}
|
|
32
|
-
/>
|
|
33
|
-
<Header
|
|
34
|
-
as="h4"
|
|
35
|
-
>
|
|
36
|
-
<Icon
|
|
37
|
-
as="i"
|
|
38
|
-
name="search"
|
|
39
|
-
/>
|
|
40
|
-
<HeaderContent>
|
|
41
|
-
<MemoizedFormattedMessage
|
|
42
|
-
id="domains.search.results.count"
|
|
43
|
-
values={
|
|
44
|
-
{
|
|
45
|
-
"count": 2,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/>
|
|
49
|
-
</HeaderContent>
|
|
50
|
-
</Header>
|
|
51
|
-
<CardGroup>
|
|
52
|
-
<Card
|
|
53
|
-
as={
|
|
54
|
-
{
|
|
55
|
-
"$$typeof": Symbol(react.forward_ref),
|
|
56
|
-
"displayName": "Link",
|
|
57
|
-
"propTypes": {
|
|
58
|
-
"innerRef": [Function],
|
|
59
|
-
"onClick": [Function],
|
|
60
|
-
"replace": [Function],
|
|
61
|
-
"target": [Function],
|
|
62
|
-
"to": [Function],
|
|
63
|
-
},
|
|
64
|
-
"render": [Function],
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
key="1"
|
|
68
|
-
link={true}
|
|
69
|
-
to="/domains/1"
|
|
70
|
-
>
|
|
71
|
-
<CardContent>
|
|
72
|
-
<CardHeader>
|
|
73
|
-
<Icon
|
|
74
|
-
as="i"
|
|
75
|
-
name="cube"
|
|
76
|
-
/>
|
|
77
|
-
domain1
|
|
78
|
-
</CardHeader>
|
|
79
|
-
<CardMeta>
|
|
80
|
-
<span>
|
|
81
|
-
<MemoizedFormattedMessage
|
|
82
|
-
id="domain"
|
|
83
|
-
/>
|
|
84
|
-
</span>
|
|
85
|
-
</CardMeta>
|
|
86
|
-
</CardContent>
|
|
87
|
-
<CardContent />
|
|
88
|
-
<CardContent
|
|
89
|
-
extra={true}
|
|
90
|
-
>
|
|
91
|
-
<Icon
|
|
92
|
-
as="i"
|
|
93
|
-
name="cubes"
|
|
94
|
-
/>
|
|
95
|
-
<MemoizedFormattedMessage
|
|
96
|
-
id="domain.props.children"
|
|
97
|
-
values={
|
|
98
|
-
{
|
|
99
|
-
"count": undefined,
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/>
|
|
103
|
-
</CardContent>
|
|
104
|
-
</Card>
|
|
105
|
-
<Card
|
|
106
|
-
as={
|
|
107
|
-
{
|
|
108
|
-
"$$typeof": Symbol(react.forward_ref),
|
|
109
|
-
"displayName": "Link",
|
|
110
|
-
"propTypes": {
|
|
111
|
-
"innerRef": [Function],
|
|
112
|
-
"onClick": [Function],
|
|
113
|
-
"replace": [Function],
|
|
114
|
-
"target": [Function],
|
|
115
|
-
"to": [Function],
|
|
116
|
-
},
|
|
117
|
-
"render": [Function],
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
key="2"
|
|
121
|
-
link={true}
|
|
122
|
-
to="/domains/2"
|
|
123
|
-
>
|
|
124
|
-
<CardContent>
|
|
125
|
-
<CardHeader>
|
|
126
|
-
<Icon
|
|
127
|
-
as="i"
|
|
128
|
-
name="cube"
|
|
129
|
-
/>
|
|
130
|
-
domain2
|
|
131
|
-
</CardHeader>
|
|
132
|
-
<CardMeta>
|
|
133
|
-
<span>
|
|
134
|
-
<MemoizedFormattedMessage
|
|
135
|
-
id="domain"
|
|
136
|
-
/>
|
|
137
|
-
</span>
|
|
138
|
-
</CardMeta>
|
|
139
|
-
</CardContent>
|
|
140
|
-
<CardContent />
|
|
141
|
-
<CardContent
|
|
142
|
-
extra={true}
|
|
143
|
-
>
|
|
144
|
-
<Icon
|
|
145
|
-
as="i"
|
|
146
|
-
name="cubes"
|
|
147
|
-
/>
|
|
148
|
-
<MemoizedFormattedMessage
|
|
149
|
-
id="domain.props.children"
|
|
150
|
-
values={
|
|
151
|
-
{
|
|
152
|
-
"count": undefined,
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
/>
|
|
156
|
-
</CardContent>
|
|
157
|
-
</Card>
|
|
158
|
-
</CardGroup>
|
|
159
|
-
</Fragment>
|
|
160
|
-
`;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { clearDomain, fetchDomain, updateDomain } from "../../routines";
|
|
2
|
-
import { domain } from "..";
|
|
3
|
-
|
|
4
|
-
const fooState = { foo: "bar" };
|
|
5
|
-
|
|
6
|
-
describe("reducers: domain", () => {
|
|
7
|
-
const initialState = {};
|
|
8
|
-
|
|
9
|
-
it("should provide the initial state", () => {
|
|
10
|
-
expect(domain(undefined, {})).toEqual(initialState);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("should handle the clearDomain.TRIGGER action", () => {
|
|
14
|
-
expect(domain(fooState, { type: clearDomain.TRIGGER })).toEqual(
|
|
15
|
-
initialState
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should handle the fetchDomain.TRIGGER action", () => {
|
|
20
|
-
expect(domain(fooState, { type: fetchDomain.TRIGGER })).toEqual(
|
|
21
|
-
initialState
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("should handle the fetchDomain.SUCCESS action", () => {
|
|
26
|
-
const data = {
|
|
27
|
-
id: 1,
|
|
28
|
-
name: "Domain 1",
|
|
29
|
-
external_id: "External Id 1",
|
|
30
|
-
domain_group: { id: 1, name: "Group" }
|
|
31
|
-
};
|
|
32
|
-
expect(
|
|
33
|
-
domain(fooState, {
|
|
34
|
-
type: fetchDomain.SUCCESS,
|
|
35
|
-
payload: { data }
|
|
36
|
-
})
|
|
37
|
-
).toEqual(data);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("should handle the updateDomain.SUCCESS action", () => {
|
|
41
|
-
const domain1 = {
|
|
42
|
-
id: 1,
|
|
43
|
-
name: "Domain 1",
|
|
44
|
-
external_id: "External Id 1",
|
|
45
|
-
domain_group: { id: 1, name: "Group" }
|
|
46
|
-
};
|
|
47
|
-
expect(
|
|
48
|
-
domain(fooState, {
|
|
49
|
-
type: updateDomain.SUCCESS,
|
|
50
|
-
payload: { data: domain1 }
|
|
51
|
-
})
|
|
52
|
-
).toEqual(domain1);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("should ignore unknown actions", () => {
|
|
56
|
-
expect(domain(fooState, { type: "FOO" })).toBe(fooState);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { fetchDomainsConcept } from "../../routines";
|
|
2
|
-
import { domainsConceptLoading } from "..";
|
|
3
|
-
|
|
4
|
-
const fooState = { foo: "bar" };
|
|
5
|
-
|
|
6
|
-
describe("reducers: domainsConceptLoading", () => {
|
|
7
|
-
it("should provide the initial state", () => {
|
|
8
|
-
expect(domainsConceptLoading(undefined, {})).toBe(false);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("should be true after receiving the fetchDomainsConcept.TRIGGER action", () => {
|
|
12
|
-
expect(
|
|
13
|
-
domainsConceptLoading(false, { type: fetchDomainsConcept.TRIGGER })
|
|
14
|
-
).toBe(true);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("should be false after receiving the fetchDomainsConcept.FULFILL action", () => {
|
|
18
|
-
expect(
|
|
19
|
-
domainsConceptLoading(true, { type: fetchDomainsConcept.FULFILL })
|
|
20
|
-
).toBe(false);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("should ignore unhandled actions", () => {
|
|
24
|
-
expect(domainsConceptLoading(fooState, { type: "FOO" })).toBe(fooState);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createDomain } from "../../routines";
|
|
2
|
-
import { domainCreating } from "..";
|
|
3
|
-
|
|
4
|
-
const fooState = { foo: "bar" };
|
|
5
|
-
|
|
6
|
-
describe("reducers: domainCreating", () => {
|
|
7
|
-
it("should provide the initial state", () => {
|
|
8
|
-
expect(domainCreating(undefined, {})).toBe(false);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("should be true after receiving the createDomain.TRIGGER action", () => {
|
|
12
|
-
expect(domainCreating(fooState, { type: createDomain.TRIGGER })).toBe(true);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should be false after receiving the createDomain.FULFILL action", () => {
|
|
16
|
-
expect(domainCreating(fooState, { type: createDomain.FULFILL })).toBe(
|
|
17
|
-
false
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("should ignore unhandled actions", () => {
|
|
22
|
-
expect(domainCreating(fooState, { type: "FOO" })).toBe(fooState);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { fetchDomain } from "../../routines";
|
|
2
|
-
import { domainLoading } from "..";
|
|
3
|
-
|
|
4
|
-
const fooState = { foo: "bar" };
|
|
5
|
-
|
|
6
|
-
describe("reducers: domainLoading", () => {
|
|
7
|
-
it("should provide the initial state", () => {
|
|
8
|
-
expect(domainLoading(undefined, {})).toBe(false);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("should be true after receiving the fetchDomain.TRIGGER action", () => {
|
|
12
|
-
expect(domainLoading(fooState, { type: fetchDomain.TRIGGER })).toBe(true);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should be false after receiving the fetchDomain.FULFILL action", () => {
|
|
16
|
-
expect(domainLoading(fooState, { type: fetchDomain.FULFILL })).toBe(false);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should ignore unhandled actions", () => {
|
|
20
|
-
expect(domainLoading(fooState, { type: "FOO" })).toBe(fooState);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { fetchDomain, fetchDomainMembers, clearDomain } from "../../routines";
|
|
2
|
-
import { domainMembersActions, initialState } from "../domainMembersActions";
|
|
3
|
-
|
|
4
|
-
const fooState = { foo: "bar" };
|
|
5
|
-
|
|
6
|
-
describe("reducers: domainsMembersActions", () => {
|
|
7
|
-
it("should provide the initial state", () => {
|
|
8
|
-
expect(domainMembersActions(undefined, {})).toBe(initialState);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("should be an empty object after receiving the fetchDomain.TRIGGER action", () => {
|
|
12
|
-
expect(domainMembersActions(fooState, { type: fetchDomain.TRIGGER })).toBe(
|
|
13
|
-
initialState
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("should be an empty object after receiving the clearDomain.TRIGGER action", () => {
|
|
18
|
-
expect(domainMembersActions(fooState, { type: clearDomain.TRIGGER })).toBe(
|
|
19
|
-
initialState
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("should extract links from the fetchDomainMembers.SUCCESS action", () => {
|
|
24
|
-
const self = { href: "/foo/bar", methods: ["GET", "DELETE"] };
|
|
25
|
-
const _links = { self };
|
|
26
|
-
const payload = { _links };
|
|
27
|
-
expect(
|
|
28
|
-
domainMembersActions(fooState, {
|
|
29
|
-
type: fetchDomainMembers.SUCCESS,
|
|
30
|
-
payload
|
|
31
|
-
})
|
|
32
|
-
).toBe(self);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("should ignore unhandled actions", () => {
|
|
36
|
-
expect(domainMembersActions(fooState, { type: "FOO" })).toBe(fooState);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { fetchDomainMembers } from "../../routines";
|
|
2
|
-
import { domainMembersLoading } from "..";
|
|
3
|
-
|
|
4
|
-
const fooState = { foo: "bar" };
|
|
5
|
-
|
|
6
|
-
describe("reducers: domainMembersLoading", () => {
|
|
7
|
-
it("should provide the initial state", () => {
|
|
8
|
-
expect(domainMembersLoading(undefined, {})).toBe(false);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("should be true after receiving the fetchDomainMembers.TRIGGER action", () => {
|
|
12
|
-
expect(
|
|
13
|
-
domainMembersLoading(false, { type: fetchDomainMembers.TRIGGER })
|
|
14
|
-
).toBe(true);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("should be false after receiving the fetchDomainMembers.FULFILL action", () => {
|
|
18
|
-
expect(
|
|
19
|
-
domainMembersLoading(true, { type: fetchDomainMembers.FULFILL })
|
|
20
|
-
).toBe(false);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("should ignore unhandled actions", () => {
|
|
24
|
-
expect(domainMembersLoading(fooState, { type: "FOO" })).toBe(fooState);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { clearRedirect } from "@truedat/core/routines";
|
|
2
|
-
import { createDomain, updateDomain } from "../../routines";
|
|
3
|
-
import { domainRedirect } from "..";
|
|
4
|
-
|
|
5
|
-
describe("reducers: domainRedirect", () => {
|
|
6
|
-
const id = 10;
|
|
7
|
-
const resource_id = 20;
|
|
8
|
-
const payload = { data: { id, resource_id } };
|
|
9
|
-
const initialState = "";
|
|
10
|
-
|
|
11
|
-
it("should provide the initial state", () => {
|
|
12
|
-
expect(domainRedirect(undefined, {})).toEqual("");
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should handle the clearRedirect.TRIGGER action", () => {
|
|
16
|
-
expect(domainRedirect("foo", { type: clearRedirect.TRIGGER })).toEqual(
|
|
17
|
-
initialState
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("should handle the createDomain.SUCCESS action", () => {
|
|
22
|
-
expect(
|
|
23
|
-
domainRedirect("foo", { type: createDomain.SUCCESS, payload })
|
|
24
|
-
).toEqual("/domains/10");
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("should handle the updateDomain.SUCCESS action", () => {
|
|
28
|
-
expect(
|
|
29
|
-
domainRedirect("foo", { type: updateDomain.SUCCESS, payload })
|
|
30
|
-
).toEqual("/domains/10");
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("should ignore unknown actions", () => {
|
|
34
|
-
expect(domainRedirect("foo", { type: "bar", payload })).toEqual("foo");
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { updateDomain } from "../../routines";
|
|
2
|
-
import { domainUpdating } from "..";
|
|
3
|
-
|
|
4
|
-
const fooState = { foo: "bar" };
|
|
5
|
-
|
|
6
|
-
describe("reducers: domainUpdating", () => {
|
|
7
|
-
it("should provide the initial state", () => {
|
|
8
|
-
expect(domainUpdating(undefined, {})).toBe(false);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("should be true after receiving the updateDomain.TRIGGER action", () => {
|
|
12
|
-
expect(domainUpdating(fooState, { type: updateDomain.TRIGGER })).toBe(true);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should be false after receiving the updateDomain.FULFILL action", () => {
|
|
16
|
-
expect(domainUpdating(fooState, { type: updateDomain.FULFILL })).toBe(
|
|
17
|
-
false
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("should ignore unhandled actions", () => {
|
|
22
|
-
expect(domainUpdating(fooState, { type: "FOO" })).toBe(fooState);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { fetchDomains } from "../../routines";
|
|
2
|
-
import { domains } from "..";
|
|
3
|
-
|
|
4
|
-
const fooState = { foo: "bar" };
|
|
5
|
-
|
|
6
|
-
describe("reducers: domains", () => {
|
|
7
|
-
const initialState = [];
|
|
8
|
-
|
|
9
|
-
it("should provide the initial state", () => {
|
|
10
|
-
expect(domains(undefined, {})).toEqual(initialState);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("should handle the SUCCESS action", () => {
|
|
14
|
-
const data = [
|
|
15
|
-
{ id: 1, name: "Domain 1", description: "Desc 1" },
|
|
16
|
-
{ id: 2, name: "Domain 2", description: "Desc 2", parent_id: 1 },
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
expect(
|
|
20
|
-
domains(fooState, {
|
|
21
|
-
type: fetchDomains.SUCCESS,
|
|
22
|
-
payload: { data: { data } },
|
|
23
|
-
})
|
|
24
|
-
).toMatchObject(data);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("should ignore unknown actions", () => {
|
|
28
|
-
expect(domains(fooState, { type: "FOO" })).toBe(fooState);
|
|
29
|
-
});
|
|
30
|
-
});
|