@licklist/design 0.58.6-dev.0 → 0.58.6-dev.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/bitbucket-pipelines.yml +0 -8
- package/package.json +9 -32
- package/jest.config.js +0 -29
- package/tests/Auth/Authorizer.test.tsx +0 -194
- package/tests/Auth/Layout/UserNavDropDown.test.tsx +0 -43
- package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +0 -33
- package/tests/Auth/Login/LoginComponent.test.tsx +0 -246
- package/tests/Auth/Login/LoginFormComponent.test.tsx +0 -182
- package/tests/Auth/Register/RegisterComponent.test.tsx +0 -285
- package/tests/Auth/Register/RegisterFormComponent.test.tsx +0 -170
- package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +0 -130
- package/tests/Auth/Social/SocialCallbackComponent.test.tsx +0 -133
- package/tests/Auth/Social/SocialFormComponent.test.tsx +0 -118
- package/tests/FileUpload/FileUpload.test.tsx +0 -42
- package/tests/Notification/EmailTemplate.test.tsx +0 -82
- package/tests/ProductSet/ProductSetPopover.test.tsx +0 -40
- package/tests/Report/Report.test.tsx +0 -48
- package/tests/Sales/Coupon.test.tsx +0 -51
- package/tests/Sales/SalesAndVIews.test.tsx +0 -63
- package/tests/SnippetTemplates/SnippetTemplates.test.tsx +0 -56
- package/tests/Table/FilterHelperComponent.test.tsx +0 -88
- package/tests/Table/PaginationHelperComponent.test.tsx +0 -109
- package/tests/Table/PerPageHelperComponent.test.tsx +0 -34
- package/tests/Table/TableHelperComponent.test.tsx +0 -295
- package/tests/TipTapEditor/TipTapEditor.test.tsx +0 -28
- package/tests/__mock__/hooks/useAuthApi.ts +0 -13
- package/tests/__mock__/hooks/useAuthMock.ts +0 -13
- package/tests/__mock__/hooks/useFormMock.ts +0 -27
- package/tests/__mock__/hooks/useNotificationMock.ts +0 -13
- package/tests/__mock__/hooks/useQueryMock.ts +0 -16
- package/tests/__mock__/hooks/useSocialApiMock.ts +0 -20
- package/tests/__mock__/hooks/useTranslationMock.ts +0 -17
- package/tests/__mock__/hooks/useUserApiMock.ts +0 -18
- package/tests/__mock__/hooks/useUserMock.ts +0 -13
- package/tests/__mock__/styleMock.js +0 -1
- package/tests/__mock__/windowMock.ts +0 -5
- package/tests/packages/react-query.tsx +0 -28
- package/tests/setupTests.ts +0 -10
package/bitbucket-pipelines.yml
CHANGED
|
@@ -16,11 +16,6 @@ definitions:
|
|
|
16
16
|
- yarn install --legacy-peer-deps
|
|
17
17
|
artifacts:
|
|
18
18
|
- node_modules/**
|
|
19
|
-
- step: &test
|
|
20
|
-
image: node:16.15.1-alpine3.15
|
|
21
|
-
name: Test
|
|
22
|
-
script:
|
|
23
|
-
- yarn run test
|
|
24
19
|
- step: &build
|
|
25
20
|
image: node:16.15.1-alpine3.15
|
|
26
21
|
name: Build application
|
|
@@ -55,7 +50,6 @@ pipelines:
|
|
|
55
50
|
- step:
|
|
56
51
|
<<: *install
|
|
57
52
|
- parallel:
|
|
58
|
-
- step: *test
|
|
59
53
|
- step: *build
|
|
60
54
|
- step:
|
|
61
55
|
name: Publish to NPM
|
|
@@ -70,7 +64,6 @@ pipelines:
|
|
|
70
64
|
- step:
|
|
71
65
|
<<: *install
|
|
72
66
|
- parallel:
|
|
73
|
-
- step: *test
|
|
74
67
|
- step: *build_storybook
|
|
75
68
|
- step:
|
|
76
69
|
<<: *deploy
|
|
@@ -88,5 +81,4 @@ pipelines:
|
|
|
88
81
|
"**":
|
|
89
82
|
- step: *install
|
|
90
83
|
- parallel:
|
|
91
|
-
- step: *test
|
|
92
84
|
- step: *build
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licklist/design",
|
|
3
|
-
"version": "0.58.6-dev.
|
|
3
|
+
"version": "0.58.6-dev.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
|
|
@@ -16,14 +16,11 @@
|
|
|
16
16
|
"type-check:watch": "yarn type-check -- --watch",
|
|
17
17
|
"build": "rollup -c",
|
|
18
18
|
"watch": "yarn build -- -w",
|
|
19
|
-
"test": "jest --verbose --coverage --watchAll=false",
|
|
20
|
-
"run-test": "jest --verbose --watchAll=false",
|
|
21
19
|
"lint": "eslint --ext .ts,.tsx .",
|
|
22
20
|
"lint:fix": "yarn run lint -- --fix",
|
|
23
21
|
"lint:format": "prettier \"**/*.{md,json,yml,scss}\" --check",
|
|
24
22
|
"lint:format:fix": "prettier \"**/*.{md,json,yml,scss}\" --write",
|
|
25
23
|
"prepare": "husky install",
|
|
26
|
-
"test-staged": "CI=true jest --passWithNoTests --findRelatedTests",
|
|
27
24
|
"tests": "yarn tests-staged",
|
|
28
25
|
"prettier-write": "prettier --write",
|
|
29
26
|
"tsc": "bash -c tsc -p tsconfig.json -b"
|
|
@@ -54,8 +51,8 @@
|
|
|
54
51
|
"@fortawesome/free-solid-svg-icons": "5.15.2",
|
|
55
52
|
"@fortawesome/react-fontawesome": "0.1.9",
|
|
56
53
|
"@licklist/core": ">=0.23.1-dev.3 < 0.23.1",
|
|
57
|
-
"@licklist/eslint-config": "0.
|
|
58
|
-
"@licklist/plugins": ">=0.27.
|
|
54
|
+
"@licklist/eslint-config": "0.4.5",
|
|
55
|
+
"@licklist/plugins": ">=0.27.2-dev.0 < 0.27.2",
|
|
59
56
|
"@mdx-js/react": "1.6.22",
|
|
60
57
|
"@popperjs/core": "2.11.8",
|
|
61
58
|
"@react-aria/utils": "3.9.0",
|
|
@@ -73,10 +70,6 @@
|
|
|
73
70
|
"@svgr/rollup": "5.5.0",
|
|
74
71
|
"@svgr/webpack": "5.5.0",
|
|
75
72
|
"@tanstack/react-table": "8.10.6",
|
|
76
|
-
"@testing-library/jest-dom": "5.16.1",
|
|
77
|
-
"@testing-library/react": "11.2.5",
|
|
78
|
-
"@testing-library/react-hooks": "5.1.0",
|
|
79
|
-
"@testing-library/user-event": "13.5.0",
|
|
80
73
|
"@tiptap/core": "2.0.0-beta.176",
|
|
81
74
|
"@tiptap/extension-blockquote": "2.0.0-beta.29",
|
|
82
75
|
"@tiptap/extension-bold": "2.0.0-beta.28",
|
|
@@ -99,14 +92,10 @@
|
|
|
99
92
|
"@tiptap/react": "2.0.0-beta.109",
|
|
100
93
|
"@tiptap/suggestion": "2.0.0-beta.92",
|
|
101
94
|
"@types/babel__core": "7.1.12",
|
|
102
|
-
"@types/enzyme-adapter-react-16": "1.0.6",
|
|
103
|
-
"@types/jest": "26.0.20",
|
|
104
95
|
"@types/luxon": "1.26.2",
|
|
105
96
|
"@types/mdx-js__react": "1.5.3",
|
|
106
|
-
"@types/react": "17.0.2",
|
|
107
97
|
"@types/react-bootstrap": "1.0.1",
|
|
108
98
|
"@types/react-date-range": "^1.4.4",
|
|
109
|
-
"@types/react-dom": "17.0.1",
|
|
110
99
|
"@types/react-email-editor": "1.1.7",
|
|
111
100
|
"@types/react-loader": "2.4.4",
|
|
112
101
|
"@types/react-phone-number-input": "3.0.6",
|
|
@@ -116,7 +105,6 @@
|
|
|
116
105
|
"@typescript-eslint/eslint-plugin": "5.8.1",
|
|
117
106
|
"@typescript-eslint/parser": "5.8.1",
|
|
118
107
|
"@wojtekmaj/react-daterange-picker": "^4.1.0",
|
|
119
|
-
"babel-jest": "26.6.3",
|
|
120
108
|
"babel-loader": "8.2.2",
|
|
121
109
|
"babel-plugin-inline-react-svg": "2.0.1",
|
|
122
110
|
"bootstrap": "4.6.0",
|
|
@@ -129,20 +117,16 @@
|
|
|
129
117
|
"emojibase-data": "7.0.1",
|
|
130
118
|
"emojibase-regex": "6.0.1",
|
|
131
119
|
"enzyme": "3.11.0",
|
|
132
|
-
"enzyme-adapter-react-16": "1.15.6",
|
|
133
120
|
"eslint": "7.32.0",
|
|
134
121
|
"eslint-config-airbnb": "18.2.1",
|
|
135
122
|
"eslint-config-prettier": "8.3.0",
|
|
136
|
-
"eslint-plugin-jest": "25.3.2",
|
|
137
123
|
"eslint-plugin-jsx-a11y": "6.5.1",
|
|
138
124
|
"eslint-plugin-prettier": "4.0.0",
|
|
139
125
|
"eslint-plugin-react-hooks": "4.2.0",
|
|
140
|
-
"eslint-plugin-testing-library": "5.0.1",
|
|
141
126
|
"framer-motion": "4.1.17",
|
|
142
127
|
"history": "5.3.0",
|
|
143
128
|
"husky": "7.0.4",
|
|
144
129
|
"i18next": "19.4.5",
|
|
145
|
-
"jest": "26.6.0",
|
|
146
130
|
"klona": "2.0.4",
|
|
147
131
|
"konva": "6.0.0",
|
|
148
132
|
"lint-staged": "11.1.2",
|
|
@@ -150,12 +134,12 @@
|
|
|
150
134
|
"luxon": "1.26.0",
|
|
151
135
|
"moment": "2.29.1",
|
|
152
136
|
"prettier": "2.5.1",
|
|
153
|
-
"react": "
|
|
137
|
+
"react": "17.0.2",
|
|
154
138
|
"react-bootstrap": "1.6.1",
|
|
155
139
|
"react-color": "2.19.3",
|
|
156
140
|
"react-copy-to-clipboard": "5.0.3",
|
|
157
141
|
"react-date-range": "^1.4.0",
|
|
158
|
-
"react-dom": "
|
|
142
|
+
"react-dom": "17.0.2",
|
|
159
143
|
"react-email-editor": "1.6.1",
|
|
160
144
|
"react-highlighter": "0.4.3",
|
|
161
145
|
"react-hook-form": "7.13.0",
|
|
@@ -186,7 +170,6 @@
|
|
|
186
170
|
"sass": "1.32.8",
|
|
187
171
|
"sass-loader": "10.1.1",
|
|
188
172
|
"style-loader": "2.0.0",
|
|
189
|
-
"ts-jest": "26.5.2",
|
|
190
173
|
"twemoji-parser": "14.0.0",
|
|
191
174
|
"typescript": "4.9.5",
|
|
192
175
|
"url-loader": "4.1.1",
|
|
@@ -194,24 +177,18 @@
|
|
|
194
177
|
},
|
|
195
178
|
"resolutions": {
|
|
196
179
|
"@types/react": "17.0.2",
|
|
197
|
-
"@types/react-dom": "17.0.
|
|
198
|
-
},
|
|
199
|
-
"jest": {
|
|
200
|
-
"setupFilesAfterEnv": [
|
|
201
|
-
"./jest.config.js"
|
|
202
|
-
],
|
|
203
|
-
"snapshotSerializers": [
|
|
204
|
-
"enzyme-to-json/serializer"
|
|
205
|
-
]
|
|
180
|
+
"@types/react-dom": "17.0.2"
|
|
206
181
|
},
|
|
207
182
|
"lint-staged": {
|
|
208
183
|
"*.{ts,tsx}": [
|
|
209
|
-
"yarn test-staged",
|
|
210
184
|
"yarn prettier-write",
|
|
211
185
|
"yarn lint:fix"
|
|
212
186
|
]
|
|
213
187
|
},
|
|
214
188
|
"devDependencies": {
|
|
189
|
+
"@types/react": "17.0.2",
|
|
190
|
+
"@types/react-dom": "17.0.2",
|
|
191
|
+
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
|
|
215
192
|
"identity-obj-proxy": "^3.0.0"
|
|
216
193
|
},
|
|
217
194
|
"volta": {
|
package/jest.config.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
modulePathIgnorePatterns: ["/dist/"],
|
|
6
|
-
roots: ["<rootDir>/src", "<rootDir>/tests"],
|
|
7
|
-
globals: {
|
|
8
|
-
"ts-jest": {
|
|
9
|
-
isolatedModules: true,
|
|
10
|
-
babelConfig: {
|
|
11
|
-
presets: ["@babel/preset-env", "@babel/preset-react"],
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
transform: {
|
|
16
|
-
"^.+\\.(t|j)sx?$": "ts-jest",
|
|
17
|
-
},
|
|
18
|
-
transformIgnorePatterns: [
|
|
19
|
-
"node_modules/(?!(redux-persist)/)",
|
|
20
|
-
"node_modules/(?!(@licklist)/)",
|
|
21
|
-
],
|
|
22
|
-
testRegex: ["(\\/tests\\/.*.(test|spec))\\.tsx?$"],
|
|
23
|
-
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
|
24
|
-
setupFilesAfterEnv: ["<rootDir>/tests/setupTests.ts"],
|
|
25
|
-
moduleNameMapper: {
|
|
26
|
-
"^.+\\.(css|scss|sass|less)$": "<rootDir>/tests/__mock__/styleMock.js",
|
|
27
|
-
".+\\.(svg|png|jpg)$": "identity-obj-proxy",
|
|
28
|
-
},
|
|
29
|
-
};
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
|
|
2
|
-
import { mount, shallow } from "enzyme";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { act } from "react-dom/test-utils";
|
|
5
|
-
import { QueryClientProvider } from "react-query";
|
|
6
|
-
import { Authorizer } from "../../src/auth/Authorizer";
|
|
7
|
-
import useAuthMock from "../__mock__/hooks/useAuthMock";
|
|
8
|
-
import useUserMock from "../__mock__/hooks/useUserMock";
|
|
9
|
-
import useAuthApi from "../__mock__/hooks/useAuthApi";
|
|
10
|
-
import { queryClient } from "../packages/react-query";
|
|
11
|
-
|
|
12
|
-
jest.mock("react-i18next", () => ({
|
|
13
|
-
Trans: jest.fn().mockReturnValue("test"),
|
|
14
|
-
useTranslation: () => ({
|
|
15
|
-
t: jest.fn((arg) => arg),
|
|
16
|
-
}),
|
|
17
|
-
}));
|
|
18
|
-
jest.mock("@licklist/plugins/dist/context/user/hooks/useAuth");
|
|
19
|
-
jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
|
|
20
|
-
jest.mock("@licklist/plugins/dist/hooks/Api/useAuthApi");
|
|
21
|
-
|
|
22
|
-
const DEFAULT_PROFILE_RESPONSE = {
|
|
23
|
-
useProfile: () => ({
|
|
24
|
-
isLoading: false,
|
|
25
|
-
isFetching: false,
|
|
26
|
-
isError: false,
|
|
27
|
-
data: { access_token: "test" },
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const DEFAULT_PROFILE_LOADING_RESPONSE = {
|
|
32
|
-
useProfile: () => ({
|
|
33
|
-
isLoading: true,
|
|
34
|
-
isFetching: false,
|
|
35
|
-
isError: false,
|
|
36
|
-
data: { access_token: "test" },
|
|
37
|
-
}),
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
describe("Authorizer", () => {
|
|
41
|
-
it("should be rendered without issues", () => {
|
|
42
|
-
useAuthMock({
|
|
43
|
-
secrets: null,
|
|
44
|
-
});
|
|
45
|
-
useUserMock({
|
|
46
|
-
profile: null,
|
|
47
|
-
});
|
|
48
|
-
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
49
|
-
|
|
50
|
-
const component = shallow(
|
|
51
|
-
<QueryClientProvider client={queryClient}>
|
|
52
|
-
<Authorizer />
|
|
53
|
-
</QueryClientProvider>
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
expect(component.exists()).toBeTruthy();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("should render children if authorized", () => {
|
|
60
|
-
let component: any;
|
|
61
|
-
|
|
62
|
-
useAuthMock({
|
|
63
|
-
secrets: "not-null",
|
|
64
|
-
});
|
|
65
|
-
useUserMock({
|
|
66
|
-
profile: "not-null",
|
|
67
|
-
});
|
|
68
|
-
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
69
|
-
|
|
70
|
-
RouteService.getCurrentPage = jest.fn();
|
|
71
|
-
RouteService.getCurrentRoute = jest.fn();
|
|
72
|
-
RouteService.cleanRedirect = jest.fn();
|
|
73
|
-
|
|
74
|
-
act(() => {
|
|
75
|
-
component = mount(
|
|
76
|
-
<QueryClientProvider client={queryClient}>
|
|
77
|
-
<Authorizer>
|
|
78
|
-
<p>test</p>
|
|
79
|
-
</Authorizer>
|
|
80
|
-
</QueryClientProvider>
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
component.update();
|
|
85
|
-
|
|
86
|
-
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
|
|
87
|
-
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
|
|
88
|
-
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
|
|
89
|
-
expect(component.exists()).toBeTruthy();
|
|
90
|
-
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("should render children if current page is login", () => {
|
|
94
|
-
let component: any;
|
|
95
|
-
|
|
96
|
-
useAuthMock({
|
|
97
|
-
secrets: null,
|
|
98
|
-
});
|
|
99
|
-
useUserMock({
|
|
100
|
-
profile: null,
|
|
101
|
-
});
|
|
102
|
-
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
103
|
-
|
|
104
|
-
RouteService.getCurrentPage = jest.fn().mockReturnValue("/login");
|
|
105
|
-
RouteService.getCurrentRoute = jest.fn();
|
|
106
|
-
RouteService.cleanRedirect = jest.fn();
|
|
107
|
-
|
|
108
|
-
act(() => {
|
|
109
|
-
component = mount(
|
|
110
|
-
<QueryClientProvider client={queryClient}>
|
|
111
|
-
<Authorizer>
|
|
112
|
-
<p>test</p>
|
|
113
|
-
</Authorizer>
|
|
114
|
-
</QueryClientProvider>
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
component.update();
|
|
119
|
-
|
|
120
|
-
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
|
|
121
|
-
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
|
|
122
|
-
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
|
|
123
|
-
expect(component.exists()).toBeTruthy();
|
|
124
|
-
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("should NOT render children if profile is loading or fetching", () => {
|
|
128
|
-
let component: any;
|
|
129
|
-
|
|
130
|
-
useAuthMock({
|
|
131
|
-
secrets: null,
|
|
132
|
-
});
|
|
133
|
-
useUserMock({
|
|
134
|
-
profile: null,
|
|
135
|
-
});
|
|
136
|
-
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
137
|
-
|
|
138
|
-
RouteService.getCurrentPage = jest.fn();
|
|
139
|
-
RouteService.getCurrentRoute = jest.fn();
|
|
140
|
-
RouteService.cleanRedirect = jest.fn();
|
|
141
|
-
|
|
142
|
-
act(() => {
|
|
143
|
-
component = mount(
|
|
144
|
-
<QueryClientProvider client={queryClient}>
|
|
145
|
-
<Authorizer>
|
|
146
|
-
<p>test</p>
|
|
147
|
-
</Authorizer>
|
|
148
|
-
</QueryClientProvider>
|
|
149
|
-
);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
component.update();
|
|
153
|
-
|
|
154
|
-
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
|
|
155
|
-
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
|
|
156
|
-
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
|
|
157
|
-
expect(component.exists()).toBeTruthy();
|
|
158
|
-
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it("should NOT render children if unauthorized and current page is not login", () => {
|
|
162
|
-
let component: any;
|
|
163
|
-
|
|
164
|
-
useAuthMock({
|
|
165
|
-
secrets: null,
|
|
166
|
-
});
|
|
167
|
-
useUserMock({
|
|
168
|
-
profile: null,
|
|
169
|
-
});
|
|
170
|
-
useAuthApi(DEFAULT_PROFILE_RESPONSE);
|
|
171
|
-
|
|
172
|
-
RouteService.getCurrentPage = jest.fn();
|
|
173
|
-
RouteService.getCurrentRoute = jest.fn();
|
|
174
|
-
RouteService.cleanRedirect = jest.fn();
|
|
175
|
-
|
|
176
|
-
act(() => {
|
|
177
|
-
component = mount(
|
|
178
|
-
<QueryClientProvider client={queryClient}>
|
|
179
|
-
<Authorizer>
|
|
180
|
-
<p>test</p>
|
|
181
|
-
</Authorizer>
|
|
182
|
-
</QueryClientProvider>
|
|
183
|
-
);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
component.update();
|
|
187
|
-
|
|
188
|
-
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(3);
|
|
189
|
-
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(1);
|
|
190
|
-
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(1);
|
|
191
|
-
expect(component.exists()).toBeTruthy();
|
|
192
|
-
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
193
|
-
});
|
|
194
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
|
|
2
|
-
import { mount, shallow } from "enzyme";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import useTranslationMock from "../../__mock__/hooks/useTranslationMock";
|
|
5
|
-
import useUserMock from "../../__mock__/hooks/useUserMock";
|
|
6
|
-
import { UserNavDropDown } from "../../../src/auth/Layout/UserNavDropDown";
|
|
7
|
-
|
|
8
|
-
jest.mock("react-i18next");
|
|
9
|
-
jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
|
|
10
|
-
|
|
11
|
-
describe("UserNavDropDown", () => {
|
|
12
|
-
it("should be rendered without issues", () => {
|
|
13
|
-
useTranslationMock({
|
|
14
|
-
t: jest.fn(),
|
|
15
|
-
});
|
|
16
|
-
useUserMock({
|
|
17
|
-
profile: null,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const component = shallow(<UserNavDropDown />);
|
|
21
|
-
|
|
22
|
-
expect(component.exists()).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("should logout on click", () => {
|
|
26
|
-
useTranslationMock({
|
|
27
|
-
t: jest.fn(),
|
|
28
|
-
});
|
|
29
|
-
useUserMock({
|
|
30
|
-
logout: jest.fn(),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
RouteService.redirectTo = jest.fn();
|
|
34
|
-
|
|
35
|
-
const component = mount(<UserNavDropDown />);
|
|
36
|
-
|
|
37
|
-
expect(component.exists()).toBeTruthy();
|
|
38
|
-
|
|
39
|
-
component.children().prop("onClick")();
|
|
40
|
-
|
|
41
|
-
expect(RouteService.redirectTo).toHaveBeenCalledTimes(1);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { IUser } from "@licklist/plugins/dist/types/context/user/IUser";
|
|
2
|
-
import { shallow } from "enzyme";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { UserNavDropDownToggle } from "../../../src/auth/Layout/UserNavDropDownToggle";
|
|
5
|
-
import useTranslationMock from "../../__mock__/hooks/useTranslationMock";
|
|
6
|
-
|
|
7
|
-
jest.mock("react-i18next");
|
|
8
|
-
jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
|
|
9
|
-
|
|
10
|
-
const user: IUser = {
|
|
11
|
-
id: 1,
|
|
12
|
-
first_name: "first_name",
|
|
13
|
-
last_name: "last_name",
|
|
14
|
-
email: "email",
|
|
15
|
-
user_roles: [],
|
|
16
|
-
user_detail: {
|
|
17
|
-
postcode: "",
|
|
18
|
-
birthday: "",
|
|
19
|
-
phone: "",
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
describe("UserNavDropDownToggle", () => {
|
|
24
|
-
it("should be rendered without issues", () => {
|
|
25
|
-
useTranslationMock({
|
|
26
|
-
t: jest.fn(),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const component = shallow(<UserNavDropDownToggle user={user} />);
|
|
30
|
-
|
|
31
|
-
expect(component.exists()).toBeTruthy();
|
|
32
|
-
});
|
|
33
|
-
});
|