@thoughtspot/visual-embed-sdk 1.20.0-prerender.2 → 1.20.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.
Files changed (182) hide show
  1. package/README.md +1 -1
  2. package/dist/src/auth.d.ts +2 -38
  3. package/dist/src/auth.d.ts.map +1 -1
  4. package/dist/src/config.d.ts +0 -1
  5. package/dist/src/config.d.ts.map +1 -1
  6. package/dist/src/embed/app.d.ts +5 -17
  7. package/dist/src/embed/app.d.ts.map +1 -1
  8. package/dist/src/embed/base.d.ts +9 -20
  9. package/dist/src/embed/base.d.ts.map +1 -1
  10. package/dist/src/embed/liveboard.d.ts +5 -17
  11. package/dist/src/embed/liveboard.d.ts.map +1 -1
  12. package/dist/src/embed/search-bar.d.ts +0 -3
  13. package/dist/src/embed/search-bar.d.ts.map +1 -1
  14. package/dist/src/embed/search.d.ts +5 -9
  15. package/dist/src/embed/search.d.ts.map +1 -1
  16. package/dist/src/embed/ts-embed.d.ts +6 -43
  17. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  18. package/dist/src/errors.d.ts.map +1 -1
  19. package/dist/src/index.d.ts.map +1 -1
  20. package/dist/src/mixpanel-service.d.ts +0 -8
  21. package/dist/src/mixpanel-service.d.ts.map +1 -1
  22. package/dist/src/react/index.d.ts.map +1 -1
  23. package/dist/src/react/util.d.ts +0 -4
  24. package/dist/src/react/util.d.ts.map +1 -1
  25. package/dist/src/test/test-utils.d.ts +2 -11
  26. package/dist/src/test/test-utils.d.ts.map +1 -1
  27. package/dist/src/types.d.ts +76 -273
  28. package/dist/src/types.d.ts.map +1 -1
  29. package/dist/src/utils/answerService.d.ts +0 -7
  30. package/dist/src/utils/answerService.d.ts.map +1 -1
  31. package/dist/src/utils/authService.d.ts +0 -30
  32. package/dist/src/utils/authService.d.ts.map +1 -1
  33. package/dist/src/utils/processData.d.ts +0 -12
  34. package/dist/src/utils/processData.d.ts.map +1 -1
  35. package/dist/src/utils/processTrigger.d.ts +0 -7
  36. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  37. package/dist/src/utils.d.ts +0 -12
  38. package/dist/src/utils.d.ts.map +1 -1
  39. package/dist/tsembed.es.js +262 -637
  40. package/dist/tsembed.js +261 -629
  41. package/lib/package.json +8 -3
  42. package/lib/src/auth.d.ts +2 -38
  43. package/lib/src/auth.d.ts.map +1 -1
  44. package/lib/src/auth.js +25 -70
  45. package/lib/src/auth.js.map +1 -1
  46. package/lib/src/auth.spec.js +5 -14
  47. package/lib/src/auth.spec.js.map +1 -1
  48. package/lib/src/config.d.ts +0 -1
  49. package/lib/src/config.d.ts.map +1 -1
  50. package/lib/src/config.js +3 -5
  51. package/lib/src/config.js.map +1 -1
  52. package/lib/src/config.spec.js.map +1 -1
  53. package/lib/src/embed/app.d.ts +5 -17
  54. package/lib/src/embed/app.d.ts.map +1 -1
  55. package/lib/src/embed/app.js +15 -25
  56. package/lib/src/embed/app.js.map +1 -1
  57. package/lib/src/embed/app.spec.js +12 -12
  58. package/lib/src/embed/app.spec.js.map +1 -1
  59. package/lib/src/embed/base.d.ts +9 -20
  60. package/lib/src/embed/base.d.ts.map +1 -1
  61. package/lib/src/embed/base.js +15 -31
  62. package/lib/src/embed/base.js.map +1 -1
  63. package/lib/src/embed/base.spec.js.map +1 -1
  64. package/lib/src/embed/embed.spec.js +1 -1
  65. package/lib/src/embed/embed.spec.js.map +1 -1
  66. package/lib/src/embed/liveboard.d.ts +5 -17
  67. package/lib/src/embed/liveboard.d.ts.map +1 -1
  68. package/lib/src/embed/liveboard.js +37 -49
  69. package/lib/src/embed/liveboard.js.map +1 -1
  70. package/lib/src/embed/liveboard.spec.js +30 -37
  71. package/lib/src/embed/liveboard.spec.js.map +1 -1
  72. package/lib/src/embed/pinboard.spec.js +26 -14
  73. package/lib/src/embed/pinboard.spec.js.map +1 -1
  74. package/lib/src/embed/search-bar.d.ts +0 -3
  75. package/lib/src/embed/search-bar.d.ts.map +1 -1
  76. package/lib/src/embed/search-bar.js +6 -5
  77. package/lib/src/embed/search-bar.js.map +1 -1
  78. package/lib/src/embed/search.d.ts +5 -9
  79. package/lib/src/embed/search.d.ts.map +1 -1
  80. package/lib/src/embed/search.js +14 -18
  81. package/lib/src/embed/search.js.map +1 -1
  82. package/lib/src/embed/search.spec.js +19 -16
  83. package/lib/src/embed/search.spec.js.map +1 -1
  84. package/lib/src/embed/searchEmbed-basic-auth.spec.js +0 -4
  85. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
  86. package/lib/src/embed/ts-embed.d.ts +6 -43
  87. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  88. package/lib/src/embed/ts-embed.js +72 -117
  89. package/lib/src/embed/ts-embed.js.map +1 -1
  90. package/lib/src/embed/ts-embed.spec.js +24 -23
  91. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  92. package/lib/src/errors.d.ts.map +1 -1
  93. package/lib/src/errors.js.map +1 -1
  94. package/lib/src/index.d.ts.map +1 -1
  95. package/lib/src/index.js +2 -2
  96. package/lib/src/index.js.map +1 -1
  97. package/lib/src/mixpanel-service.d.ts +0 -8
  98. package/lib/src/mixpanel-service.d.ts.map +1 -1
  99. package/lib/src/mixpanel-service.js +1 -13
  100. package/lib/src/mixpanel-service.js.map +1 -1
  101. package/lib/src/mixpanel-service.spec.js.map +1 -1
  102. package/lib/src/react/index.d.ts.map +1 -1
  103. package/lib/src/react/index.js +6 -6
  104. package/lib/src/react/index.js.map +1 -1
  105. package/lib/src/react/index.spec.js +6 -15
  106. package/lib/src/react/index.spec.js.map +1 -1
  107. package/lib/src/react/util.d.ts +0 -4
  108. package/lib/src/react/util.d.ts.map +1 -1
  109. package/lib/src/react/util.js +0 -4
  110. package/lib/src/react/util.js.map +1 -1
  111. package/lib/src/test/test-utils.d.ts +2 -11
  112. package/lib/src/test/test-utils.d.ts.map +1 -1
  113. package/lib/src/test/test-utils.js +25 -36
  114. package/lib/src/test/test-utils.js.map +1 -1
  115. package/lib/src/types.d.ts +76 -273
  116. package/lib/src/types.d.ts.map +1 -1
  117. package/lib/src/types.js +54 -200
  118. package/lib/src/types.js.map +1 -1
  119. package/lib/src/utils/answerService.d.ts +0 -7
  120. package/lib/src/utils/answerService.d.ts.map +1 -1
  121. package/lib/src/utils/answerService.js +0 -7
  122. package/lib/src/utils/answerService.js.map +1 -1
  123. package/lib/src/utils/answerService.spec.js.map +1 -1
  124. package/lib/src/utils/authService.d.ts +0 -30
  125. package/lib/src/utils/authService.d.ts.map +1 -1
  126. package/lib/src/utils/authService.js +2 -39
  127. package/lib/src/utils/authService.js.map +1 -1
  128. package/lib/src/utils/authService.spec.js.map +1 -1
  129. package/lib/src/utils/processData.d.ts +0 -12
  130. package/lib/src/utils/processData.d.ts.map +1 -1
  131. package/lib/src/utils/processData.js +5 -33
  132. package/lib/src/utils/processData.js.map +1 -1
  133. package/lib/src/utils/processData.spec.js.map +1 -1
  134. package/lib/src/utils/processTrigger.d.ts +0 -7
  135. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  136. package/lib/src/utils/processTrigger.js +3 -17
  137. package/lib/src/utils/processTrigger.js.map +1 -1
  138. package/lib/src/utils/processTrigger.spec.js.map +1 -1
  139. package/lib/src/utils.d.ts +0 -12
  140. package/lib/src/utils.d.ts.map +1 -1
  141. package/lib/src/utils.js +19 -24
  142. package/lib/src/utils.js.map +1 -1
  143. package/lib/src/utils.spec.js.map +1 -1
  144. package/lib/src/visual-embed-sdk.d.ts +102 -406
  145. package/package.json +8 -3
  146. package/src/auth.spec.ts +150 -68
  147. package/src/auth.ts +108 -102
  148. package/src/config.spec.ts +4 -2
  149. package/src/config.ts +3 -5
  150. package/src/embed/app.spec.ts +14 -25
  151. package/src/embed/app.ts +35 -47
  152. package/src/embed/base.spec.ts +9 -3
  153. package/src/embed/base.ts +53 -51
  154. package/src/embed/embed.spec.ts +6 -5
  155. package/src/embed/liveboard.spec.ts +37 -56
  156. package/src/embed/liveboard.ts +64 -66
  157. package/src/embed/pinboard.spec.ts +29 -26
  158. package/src/embed/search-bar.tsx +8 -10
  159. package/src/embed/search.spec.ts +21 -31
  160. package/src/embed/search.ts +25 -26
  161. package/src/embed/searchEmbed-basic-auth.spec.ts +28 -22
  162. package/src/embed/ts-embed.spec.ts +148 -70
  163. package/src/embed/ts-embed.ts +157 -147
  164. package/src/errors.ts +6 -3
  165. package/src/index.ts +10 -4
  166. package/src/mixpanel-service.spec.ts +3 -1
  167. package/src/mixpanel-service.ts +1 -13
  168. package/src/react/index.spec.tsx +13 -37
  169. package/src/react/index.tsx +57 -38
  170. package/src/react/util.ts +4 -8
  171. package/src/test/test-utils.ts +39 -43
  172. package/src/types.ts +78 -270
  173. package/src/utils/answerService.spec.ts +5 -3
  174. package/src/utils/answerService.ts +17 -21
  175. package/src/utils/authService.spec.ts +41 -26
  176. package/src/utils/authService.ts +21 -47
  177. package/src/utils/processData.spec.ts +59 -26
  178. package/src/utils/processData.ts +14 -36
  179. package/src/utils/processTrigger.spec.ts +6 -1
  180. package/src/utils/processTrigger.ts +9 -18
  181. package/src/utils.spec.ts +12 -8
  182. package/src/utils.ts +26 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.20.0-prerender.2",
3
+ "version": "1.20.1",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -25,6 +25,13 @@
25
25
  ]
26
26
  }
27
27
  },
28
+ "typesVersions": {
29
+ "*": {
30
+ "react": [
31
+ "./lib/src/react/index.d.ts"
32
+ ]
33
+ }
34
+ },
28
35
  "scripts": {
29
36
  "lint": "eslint 'src/**'",
30
37
  "lint:fix": "eslint 'src/**/*.*' --fix",
@@ -56,8 +63,6 @@
56
63
  "algoliasearch": "^4.10.5",
57
64
  "classnames": "^2.3.1",
58
65
  "dompurify": "^2.3.4",
59
- "eslint-plugin-comment-length": "^0.9.2",
60
- "eslint-plugin-jsdoc": "^40.1.0",
61
66
  "eventemitter3": "^4.0.7",
62
67
  "gatsby-plugin-vercel": "^1.0.3",
63
68
  "html-react-parser": "^1.4.12",
package/src/auth.spec.ts CHANGED
@@ -105,8 +105,12 @@ describe('Unit test for auth', () => {
105
105
  });
106
106
 
107
107
  test('endpoints, SAML_LOGIN_TEMPLATE', () => {
108
- const ssoTemplateUrl = authInstance.EndPoints.SAML_LOGIN_TEMPLATE(thoughtSpotHost);
109
- expect(ssoTemplateUrl).toBe(`/callosum/v1/saml/login?targetURLPath=${thoughtSpotHost}`);
108
+ const ssoTemplateUrl = authInstance.EndPoints.SAML_LOGIN_TEMPLATE(
109
+ thoughtSpotHost,
110
+ );
111
+ expect(ssoTemplateUrl).toBe(
112
+ `/callosum/v1/saml/login?targetURLPath=${thoughtSpotHost}`,
113
+ );
110
114
  });
111
115
 
112
116
  test('when session info giving response', async () => {
@@ -129,7 +133,9 @@ describe('Unit test for auth', () => {
129
133
 
130
134
  test('doTokenAuth: when authEndpoint and getAuthToken are not there, it throw error', async () => {
131
135
  try {
132
- await authInstance.doTokenAuth(embedConfig.doTokenAuthFailureWithoutAuthEndPoint);
136
+ await authInstance.doTokenAuth(
137
+ embedConfig.doTokenAuthFailureWithoutAuthEndPoint,
138
+ );
133
139
  } catch (e) {
134
140
  expect(e.message).toBe(
135
141
  'Either auth endpoint or getAuthToken function must be provided',
@@ -138,24 +144,35 @@ describe('Unit test for auth', () => {
138
144
  });
139
145
 
140
146
  test('doTokenAuth: when user is loggedIn', async () => {
141
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(async () => ({
142
- json: () => mockSessionInfo,
143
- status: 200,
144
- }));
145
- await authInstance.doTokenAuth(embedConfig.doTokenAuthSuccess('authToken'));
147
+ jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(
148
+ async () => ({
149
+ json: () => mockSessionInfo,
150
+ status: 200,
151
+ }),
152
+ );
153
+ await authInstance.doTokenAuth(
154
+ embedConfig.doTokenAuthSuccess('authToken'),
155
+ );
146
156
  expect(authService.fetchSessionInfoService).toBeCalled();
147
157
  expect(authInstance.loggedInStatus).toBe(true);
148
158
  });
149
159
 
150
160
  test('doTokenAuth: when user is not loggedIn & getAuthToken have response', async () => {
151
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(() => false);
152
- jest.spyOn(authService, 'fetchAuthTokenService').mockImplementation(() => ({
153
- text: () => Promise.resolve('abc'),
154
- }));
155
- jest.spyOn(authService, 'fetchAuthService').mockImplementation(() => Promise.resolve({
156
- status: 200,
157
- }));
158
- await authInstance.doTokenAuth(embedConfig.doTokenAuthSuccess('authToken2'));
161
+ jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(
162
+ () => false,
163
+ );
164
+ jest.spyOn(
165
+ authService,
166
+ 'fetchAuthTokenService',
167
+ ).mockImplementation(() => ({ text: () => Promise.resolve('abc') }));
168
+ jest.spyOn(authService, 'fetchAuthService').mockImplementation(() =>
169
+ Promise.resolve({
170
+ status: 200,
171
+ }),
172
+ );
173
+ await authInstance.doTokenAuth(
174
+ embedConfig.doTokenAuthSuccess('authToken2'),
175
+ );
159
176
  expect(authService.fetchSessionInfoService).toBeCalled();
160
177
  expect(authService.fetchAuthService).toBeCalledWith(
161
178
  thoughtSpotHost,
@@ -165,17 +182,32 @@ describe('Unit test for auth', () => {
165
182
  });
166
183
 
167
184
  test('doTokenAuth: when user is not loggedIn & getAuthToken not present, isLoggedIn should called', async () => {
168
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(() => false);
169
- jest.spyOn(authService, 'fetchAuthTokenService').mockImplementation(() => Promise.resolve({ text: () => Promise.resolve('abc') }));
170
- jest.spyOn(authService, 'fetchAuthService').mockImplementation(() => Promise.resolve({
171
- status: 200,
172
- ok: true,
173
- }));
174
- await authInstance.doTokenAuth(embedConfig.doTokenAuthFailureWithoutGetAuthToken);
185
+ jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(
186
+ () => false,
187
+ );
188
+ jest.spyOn(
189
+ authService,
190
+ 'fetchAuthTokenService',
191
+ ).mockImplementation(() =>
192
+ Promise.resolve({ text: () => Promise.resolve('abc') }),
193
+ );
194
+ jest.spyOn(authService, 'fetchAuthService').mockImplementation(() =>
195
+ Promise.resolve({
196
+ status: 200,
197
+ ok: true,
198
+ }),
199
+ );
200
+ await authInstance.doTokenAuth(
201
+ embedConfig.doTokenAuthFailureWithoutGetAuthToken,
202
+ );
175
203
  await executeAfterWait(() => {
176
204
  expect(authInstance.loggedInStatus).toBe(true);
177
205
  expect(authService.fetchSessionInfoService).toBeCalled();
178
- expect(authService.fetchAuthService).toBeCalledWith(thoughtSpotHost, username, 'abc');
206
+ expect(authService.fetchAuthService).toBeCalledWith(
207
+ thoughtSpotHost,
208
+ username,
209
+ 'abc',
210
+ );
179
211
  });
180
212
  });
181
213
 
@@ -186,14 +218,20 @@ describe('Unit test for auth', () => {
186
218
  jest.spyOn(window, 'alert').mockClear();
187
219
  jest.spyOn(window, 'alert').mockReturnValue(undefined);
188
220
  jest.spyOn(authService, 'fetchAuthService').mockReset();
189
- jest.spyOn(authService, 'fetchAuthService').mockImplementation(() => Promise.resolve({
190
- status: 200,
191
- ok: true,
192
- }));
193
- await authInstance.doTokenAuth(embedConfig.doTokenAuthSuccess('authToken3'));
221
+ jest.spyOn(authService, 'fetchAuthService').mockImplementation(() =>
222
+ Promise.resolve({
223
+ status: 200,
224
+ ok: true,
225
+ }),
226
+ );
227
+ await authInstance.doTokenAuth(
228
+ embedConfig.doTokenAuthSuccess('authToken3'),
229
+ );
194
230
 
195
231
  try {
196
- await authInstance.doTokenAuth(embedConfig.doTokenAuthSuccess('authToken3'));
232
+ await authInstance.doTokenAuth(
233
+ embedConfig.doTokenAuthSuccess('authToken3'),
234
+ );
197
235
  expect(false).toBe(true);
198
236
  } catch (e) {
199
237
  expect(e.message).toContain('Duplicate token');
@@ -211,36 +249,49 @@ describe('Unit test for auth', () => {
211
249
  status: 401,
212
250
  })
213
251
  .mockClear();
214
- jest.spyOn(authService, 'fetchAuthTokenService').mockImplementation(() => ({
215
- text: () => Promise.resolve('abc'),
216
- }));
217
- jest.spyOn(authService, 'fetchAuthService').mockImplementation(() => Promise.resolve({
218
- status: 200,
219
- ok: true,
220
- }));
221
- const isLoggedIn = await authInstance.doTokenAuth(embedConfig.doTokenAuthWithCookieDetect);
252
+ jest.spyOn(
253
+ authService,
254
+ 'fetchAuthTokenService',
255
+ ).mockImplementation(() => ({ text: () => Promise.resolve('abc') }));
256
+ jest.spyOn(authService, 'fetchAuthService').mockImplementation(() =>
257
+ Promise.resolve({
258
+ status: 200,
259
+ ok: true,
260
+ }),
261
+ );
262
+ const isLoggedIn = await authInstance.doTokenAuth(
263
+ embedConfig.doTokenAuthWithCookieDetect,
264
+ );
222
265
  expect(authService.fetchSessionInfoService).toHaveBeenCalledTimes(2);
223
266
  expect(isLoggedIn).toBe(false);
224
267
  });
225
268
 
226
269
  test('doTokenAuth: when user is not loggedIn & fetchAuthPostService failed than fetchAuthService should call', async () => {
227
270
  jest.spyOn(window, 'alert').mockImplementation(() => undefined);
228
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(() => false);
229
- jest.spyOn(authService, 'fetchAuthTokenService').mockImplementation(() => ({
230
- text: () => Promise.resolve('abc'),
231
- }));
271
+ jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(
272
+ () => false,
273
+ );
274
+ jest.spyOn(
275
+ authService,
276
+ 'fetchAuthTokenService',
277
+ ).mockImplementation(() => ({ text: () => Promise.resolve('abc') }));
232
278
  jest.spyOn(authService, 'fetchAuthPostService').mockImplementation(() =>
233
- // eslint-disable-next-line prefer-promise-reject-errors, implicit-arrow-linebreak
279
+ // eslint-disable-next-line prefer-promise-reject-errors
234
280
  Promise.reject({
235
281
  status: 500,
236
- }));
237
- jest.spyOn(authService, 'fetchAuthService').mockImplementation(() => Promise.resolve({
238
- status: 200,
239
- type: 'opaqueredirect',
240
- }));
241
- expect(await authInstance.doTokenAuth(embedConfig.doTokenAuthSuccess('authToken2'))).toBe(
242
- true,
282
+ }),
243
283
  );
284
+ jest.spyOn(authService, 'fetchAuthService').mockImplementation(() =>
285
+ Promise.resolve({
286
+ status: 200,
287
+ type: 'opaqueredirect',
288
+ }),
289
+ );
290
+ expect(
291
+ await authInstance.doTokenAuth(
292
+ embedConfig.doTokenAuthSuccess('authToken2'),
293
+ ),
294
+ ).toBe(true);
244
295
  expect(authService.fetchSessionInfoService).toBeCalled();
245
296
  expect(authService.fetchAuthPostService).toBeCalledWith(
246
297
  thoughtSpotHost,
@@ -260,8 +311,14 @@ describe('Unit test for auth', () => {
260
311
  });
261
312
 
262
313
  it('when user is loggedIn', async () => {
263
- spyOn(checkReleaseVersionInBetaInstance, 'checkReleaseVersionInBeta');
264
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(async () => ({
314
+ spyOn(
315
+ checkReleaseVersionInBetaInstance,
316
+ 'checkReleaseVersionInBeta',
317
+ );
318
+ jest.spyOn(
319
+ authService,
320
+ 'fetchSessionInfoService',
321
+ ).mockImplementation(async () => ({
265
322
  json: () => mockSessionInfo,
266
323
  status: 200,
267
324
  }));
@@ -271,11 +328,14 @@ describe('Unit test for auth', () => {
271
328
  });
272
329
 
273
330
  it('when user is not loggedIn', async () => {
274
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(() => Promise.reject());
275
- jest.spyOn(authService, 'fetchBasicAuthService').mockImplementation(() => ({
276
- status: 200,
277
- ok: true,
278
- }));
331
+ jest.spyOn(
332
+ authService,
333
+ 'fetchSessionInfoService',
334
+ ).mockImplementation(() => Promise.reject());
335
+ jest.spyOn(
336
+ authService,
337
+ 'fetchBasicAuthService',
338
+ ).mockImplementation(() => ({ status: 200, ok: true }));
279
339
 
280
340
  await authInstance.doBasicAuth(embedConfig.doBasicAuth);
281
341
  expect(authService.fetchSessionInfoService).toBeCalled();
@@ -293,14 +353,20 @@ describe('Unit test for auth', () => {
293
353
  });
294
354
 
295
355
  it('when user is loggedIn & isAtSSORedirectUrl is true', async () => {
296
- spyOn(checkReleaseVersionInBetaInstance, 'checkReleaseVersionInBeta');
356
+ spyOn(
357
+ checkReleaseVersionInBetaInstance,
358
+ 'checkReleaseVersionInBeta',
359
+ );
297
360
  Object.defineProperty(window, 'location', {
298
361
  value: {
299
362
  href: authInstance.SSO_REDIRECTION_MARKER_GUID,
300
363
  hash: '',
301
364
  },
302
365
  });
303
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(async () => ({
366
+ jest.spyOn(
367
+ authService,
368
+ 'fetchSessionInfoService',
369
+ ).mockImplementation(async () => ({
304
370
  json: () => mockSessionInfo,
305
371
  status: 200,
306
372
  }));
@@ -311,7 +377,10 @@ describe('Unit test for auth', () => {
311
377
  });
312
378
 
313
379
  it('when user is not loggedIn & isAtSSORedirectUrl is true', async () => {
314
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(() => Promise.reject());
380
+ jest.spyOn(
381
+ authService,
382
+ 'fetchSessionInfoService',
383
+ ).mockImplementation(() => Promise.reject());
315
384
  await authInstance.doSamlAuth(embedConfig.doSamlAuth);
316
385
  expect(authService.fetchSessionInfoService).toBeCalled();
317
386
  expect(window.location.hash).toBe('');
@@ -325,7 +394,10 @@ describe('Unit test for auth', () => {
325
394
  hash: '',
326
395
  },
327
396
  });
328
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(() => Promise.reject());
397
+ jest.spyOn(
398
+ authService,
399
+ 'fetchSessionInfoService',
400
+ ).mockImplementation(() => Promise.reject());
329
401
  await authInstance.doSamlAuth(embedConfig.doSamlAuth);
330
402
  expect(authService.fetchSessionInfoService).toBeCalled();
331
403
  expect(global.window.location.href).toBe(samalLoginUrl);
@@ -340,7 +412,10 @@ describe('Unit test for auth', () => {
340
412
  });
341
413
  spyOn(authInstance, 'samlCompletionPromise');
342
414
  global.window.open = jest.fn();
343
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(() => Promise.reject());
415
+ jest.spyOn(
416
+ authService,
417
+ 'fetchSessionInfoService',
418
+ ).mockImplementation(() => Promise.reject());
344
419
  expect(await authInstance.samlCompletionPromise).not.toBe(null);
345
420
  expect(
346
421
  await authInstance.doSamlAuth({
@@ -363,7 +438,10 @@ describe('Unit test for auth', () => {
363
438
  });
364
439
 
365
440
  it('when user is not loggedIn & isAtSSORedirectUrl is true', async () => {
366
- jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(() => Promise.reject());
441
+ jest.spyOn(
442
+ authService,
443
+ 'fetchSessionInfoService',
444
+ ).mockImplementation(() => Promise.reject());
367
445
  await authInstance.doOIDCAuth(embedConfig.doOidcAuth);
368
446
  expect(authService.fetchSessionInfoService).toBeCalled();
369
447
  expect(window.location.hash).toBe('');
@@ -401,7 +479,9 @@ describe('Unit test for auth', () => {
401
479
 
402
480
  it('authenticate: when authType is AuthServerCookieless', async () => {
403
481
  spyOn(authInstance, 'doCookielessTokenAuth');
404
- await authInstance.authenticate(embedConfig.authServerCookielessFailure);
482
+ await authInstance.authenticate(
483
+ embedConfig.authServerCookielessFailure,
484
+ );
405
485
  expect(window.location.hash).toBe('');
406
486
  expect(authInstance.doCookielessTokenAuth).toBeCalled();
407
487
  });
@@ -414,12 +494,14 @@ describe('Unit test for auth', () => {
414
494
  });
415
495
 
416
496
  it('authenticate: when authType is None', async () => {
417
- expect(await authInstance.authenticate(embedConfig.nonAuthSucess)).not.toBeInstanceOf(
418
- Error,
419
- );
497
+ expect(
498
+ await authInstance.authenticate(embedConfig.nonAuthSucess),
499
+ ).not.toBeInstanceOf(Error);
420
500
  });
421
501
 
422
502
  it('user is authenticated when loggedInStatus is true', () => {
423
- expect(authInstance.isAuthenticated()).toBe(authInstance.loggedInStatus);
503
+ expect(authInstance.isAuthenticated()).toBe(
504
+ authInstance.loggedInStatus,
505
+ );
424
506
  });
425
507
  });