@truedat/auth 8.11.1 → 8.11.3
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/auth",
|
|
3
|
-
"version": "8.11.
|
|
3
|
+
"version": "8.11.3",
|
|
4
4
|
"description": "Truedat Web Auth",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -50,45 +50,45 @@
|
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@testing-library/dom": "^10.4.
|
|
54
|
-
"@testing-library/jest-dom": "^6.6.
|
|
55
|
-
"@testing-library/react": "^16.3.
|
|
56
|
-
"@testing-library/user-event": "^14.6.
|
|
57
|
-
"@truedat/test": "8.11.
|
|
53
|
+
"@testing-library/dom": "^10.4.1",
|
|
54
|
+
"@testing-library/jest-dom": "^6.6.4",
|
|
55
|
+
"@testing-library/react": "^16.3.3",
|
|
56
|
+
"@testing-library/user-event": "^14.6.7",
|
|
57
|
+
"@truedat/test": "8.11.3",
|
|
58
58
|
"identity-obj-proxy": "^3.0.0",
|
|
59
59
|
"jest": "^29.7.0",
|
|
60
60
|
"redux-saga-test-plan": "^4.0.6"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@apollo/client": "^3.13.
|
|
64
|
-
"@truedat/core": "8.11.
|
|
65
|
-
"auth0-js": "^10.2.
|
|
66
|
-
"axios": "^1.15.
|
|
63
|
+
"@apollo/client": "^3.13.9",
|
|
64
|
+
"@truedat/core": "8.11.3",
|
|
65
|
+
"auth0-js": "^10.2.1",
|
|
66
|
+
"axios": "^1.15.2",
|
|
67
67
|
"graphql": "^16.11.0",
|
|
68
68
|
"is-hotkey": "^0.2.0",
|
|
69
69
|
"is-url": "^1.2.4",
|
|
70
70
|
"jwt-decode": "^4.0.0",
|
|
71
|
-
"lodash": "^4.17.
|
|
71
|
+
"lodash": "^4.17.23",
|
|
72
72
|
"moment": "^2.30.1",
|
|
73
73
|
"path-to-regexp": "^8.2.0",
|
|
74
74
|
"prop-types": "^15.8.1",
|
|
75
75
|
"query-string": "^7.1.3",
|
|
76
|
-
"react": "^19.2.
|
|
76
|
+
"react": "^19.2.8",
|
|
77
77
|
"react-csv": "^2.2.2",
|
|
78
|
-
"react-dom": "^19.2.
|
|
78
|
+
"react-dom": "^19.2.8",
|
|
79
79
|
"react-dropzone": "^14.3.8",
|
|
80
80
|
"react-hook-form": "^7.56.4",
|
|
81
|
-
"react-intl": "^7.1.
|
|
82
|
-
"react-moment": "^1.1.
|
|
81
|
+
"react-intl": "^7.1.14",
|
|
82
|
+
"react-moment": "^1.1.4",
|
|
83
83
|
"react-redux": "^9.2.0",
|
|
84
|
-
"react-router": "^8.3.
|
|
84
|
+
"react-router": "^8.3.1",
|
|
85
85
|
"redux": "^5.0.1",
|
|
86
86
|
"redux-saga": "^1.3.0",
|
|
87
87
|
"redux-saga-routines": "^3.2.3",
|
|
88
88
|
"reselect": "^5.1.1",
|
|
89
89
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
90
|
-
"swr": "^2.3.
|
|
90
|
+
"swr": "^2.3.8"
|
|
91
91
|
},
|
|
92
92
|
"overrides": {},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "c0d3c1ed5c9480e6207a6e696d8941043c34de2f"
|
|
94
94
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import useSWRMutation from "swr/mutation";
|
|
2
|
+
import { renderHook } from "@testing-library/react";
|
|
3
|
+
import { useGrantRequestableUsers } from "../useUsers";
|
|
4
|
+
|
|
5
|
+
jest.mock("swr/mutation", () => ({
|
|
6
|
+
__esModule: true,
|
|
7
|
+
...jest.requireActual("swr/mutation"),
|
|
8
|
+
default: jest.fn(),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
jest.mock("@truedat/core/services/api", () => ({
|
|
12
|
+
__esModule: true,
|
|
13
|
+
...jest.requireActual("@truedat/core/services/api"),
|
|
14
|
+
apiJsonPost: jest.fn(),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
describe("useGrantRequestableUsers", () => {
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
jest.clearAllMocks();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("exposes users and groups from grant_requestable response", () => {
|
|
23
|
+
useSWRMutation.mockReturnValue({
|
|
24
|
+
data: {
|
|
25
|
+
data: {
|
|
26
|
+
data: [{ id: 1, full_name: "Ada" }],
|
|
27
|
+
groups: [{ id: 10, name: "finance", alias: "Fin" }],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
trigger: jest.fn(),
|
|
31
|
+
error: undefined,
|
|
32
|
+
isMutating: false,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const { result } = renderHook(() => useGrantRequestableUsers());
|
|
36
|
+
|
|
37
|
+
expect(result.current.users).toEqual([{ id: 1, full_name: "Ada" }]);
|
|
38
|
+
expect(result.current.groups).toEqual([
|
|
39
|
+
{ id: 10, name: "finance", alias: "Fin" },
|
|
40
|
+
]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("exposes empty groups when grant_requestable has no groups", () => {
|
|
44
|
+
useSWRMutation.mockReturnValue({
|
|
45
|
+
data: {
|
|
46
|
+
data: {
|
|
47
|
+
data: [{ id: 1, full_name: "Ada" }],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
trigger: jest.fn(),
|
|
51
|
+
error: undefined,
|
|
52
|
+
isMutating: false,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const { result } = renderHook(() => useGrantRequestableUsers());
|
|
56
|
+
|
|
57
|
+
expect(result.current.users).toEqual([{ id: 1, full_name: "Ada" }]);
|
|
58
|
+
expect(result.current.groups).toEqual([]);
|
|
59
|
+
});
|
|
60
|
+
});
|