@truedat/bg 8.4.3 → 8.4.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "8.4.3",
3
+ "version": "8.4.4",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -51,7 +51,7 @@
51
51
  "@testing-library/jest-dom": "^6.6.3",
52
52
  "@testing-library/react": "^16.3.0",
53
53
  "@testing-library/user-event": "^14.6.1",
54
- "@truedat/test": "8.4.3",
54
+ "@truedat/test": "8.4.4",
55
55
  "identity-obj-proxy": "^3.0.0",
56
56
  "jest": "^29.7.0",
57
57
  "redux-saga-test-plan": "^4.0.6"
@@ -84,5 +84,5 @@
84
84
  "semantic-ui-react": "^3.0.0-beta.2",
85
85
  "swr": "^2.3.3"
86
86
  },
87
- "gitHead": "4c27fe8b467a2b0b26f69d4931d85d8bdf674e6d"
87
+ "gitHead": "0d8d2a2f4526c425fcef656a6004484cbd755774"
88
88
  }
@@ -1,4 +1,5 @@
1
1
  import {
2
+ clearRedirect,
2
3
  createSubscription,
3
4
  deleteSubscription,
4
5
  updateSubscription
@@ -47,49 +48,48 @@ describe("reducers: conceptRedirect", () => {
47
48
  ).toBe(redirectUrl);
48
49
  });
49
50
 
50
-
51
- it("should be link to concept on updateSubscription.SUCCESS state otherwise", () => {
51
+ it("should keep current state on updateSubscription.SUCCESS", () => {
52
52
  expect(
53
53
  conceptRedirect(fooState, {
54
54
  type: updateSubscription.SUCCESS,
55
55
  payload: { bar: "baz" }
56
56
  })
57
57
  ).toBe(fooState);
58
- expect(
59
- conceptRedirect(fooState, {
60
- type: updateSubscription.SUCCESS,
61
- payload
62
- })
63
- ).toBe(conceptUrl(concept));
64
58
  });
65
59
 
66
- it("should be link to concept on deleteSubscription.SUCCESS state otherwise", () => {
60
+ it("should keep current state on deleteSubscription.SUCCESS", () => {
67
61
  expect(
68
62
  conceptRedirect(fooState, {
69
63
  type: deleteSubscription.SUCCESS,
70
64
  payload: { bar: "baz" }
71
65
  })
72
66
  ).toBe(fooState);
73
- expect(
74
- conceptRedirect(fooState, {
75
- type: deleteSubscription.SUCCESS,
76
- payload
77
- })
78
- ).toBe(conceptUrl(concept));
79
67
  });
80
68
 
81
- it("should be link to concept on createSubscription.SUCCESS state otherwise", () => {
69
+ it("should keep current state on createSubscription.SUCCESS", () => {
82
70
  expect(
83
71
  conceptRedirect(fooState, {
84
72
  type: createSubscription.SUCCESS,
85
73
  payload: { bar: "baz" }
86
74
  })
87
75
  ).toBe(fooState);
76
+ });
77
+
78
+ it("should return initial state on clearRedirect.TRIGGER", () => {
88
79
  expect(
89
80
  conceptRedirect(fooState, {
90
- type: createSubscription.SUCCESS,
91
- payload
81
+ type: clearRedirect.TRIGGER
92
82
  })
93
- ).toBe(conceptUrl(concept));
83
+ ).toBe("");
84
+ });
85
+
86
+ it("should keep current state on conceptAction.SUCCESS when action does not redirect", () => {
87
+ expect(
88
+ conceptRedirect(fooState, {
89
+ type: conceptAction.SUCCESS,
90
+ payload: { data },
91
+ meta: { action: "archive" }
92
+ })
93
+ ).toBe(fooState);
94
94
  });
95
95
  });
@@ -36,18 +36,10 @@ export const conceptRedirect = (
36
36
  const { redirectUrl } = meta;
37
37
  return redirectUrl;
38
38
  }
39
- case updateSubscription.SUCCESS: {
40
- const { concept } = payload;
41
- return _.isNil(concept) ? state : linkTo.CONCEPT_VERSION(concept);
42
- }
43
- case deleteSubscription.SUCCESS: {
44
- const { concept } = payload;
45
- return _.isNil(concept) ? state : linkTo.CONCEPT_VERSION(concept);
46
- }
47
- case createSubscription.SUCCESS: {
48
- const { concept } = payload;
49
- return _.isNil(concept) ? state : linkTo.CONCEPT_VERSION(concept);
50
- }
39
+ case updateSubscription.SUCCESS:
40
+ case deleteSubscription.SUCCESS:
41
+ case createSubscription.SUCCESS:
42
+ return state;
51
43
  default:
52
44
  return state;
53
45
  }