@thoughtspot/visual-embed-sdk 1.20.0-alpha.2 → 1.20.0-prerender.0

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