Skip to content

Commit a876f80

Browse files
author
Iishaan Tanwar
committed
made changes suggested by code rabbit and ci should pass now
[deps] Upgraded duration-formatter to ^1.1.1 #986 Related to #986 [deps] Upgraded node-plop to ^0.32.3 #986 Related to #986 [deps] Upgraded node-plop to ^0.32.3 #986 Related to #986 [deps] Upgraded core-js to 3.47.0 #986 Related to #986 [deps] Upgraded typescript to ^5.9.3 #986 Related to #986 [deps] Upgraded concurrently to ^9.2.1 #986 Related to #986 [deps] Upgraded lodash to ^4.17.21 #986 Related to #986 [deps] Upgraded dompurify to ^3.3.1 #986 Related to #986 intermediate commit intermediate commit
1 parent b9f7b6a commit a876f80

File tree

15 files changed

+21808
-577
lines changed

15 files changed

+21808
-577
lines changed

browserTestError.log

Lines changed: 21403 additions & 0 deletions
Large diffs are not rendered by default.

client/components/mobile-phone-change/mobile-phone-change.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,8 @@ describe("<MobilePhoneChange /> rendering with placeholder translation tags", ()
161161
});
162162
});
163163

164-
const historyMock = createMemoryHistory();
165-
166164
const mountComponent = (props) => {
165+
const historyMock = createMemoryHistory();
167166
const mockedStore = {
168167
subscribe: () => {},
169168
dispatch: () => {},

client/components/mobile-phone-verification/mobile-phone-verification.test.js

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe("<MobilePhoneVerification /> rendering with placeholder translation tag
114114
Promise.resolve({
115115
status: 200,
116116
statusText: "OK",
117-
data: {active: false}
117+
data: {active: false},
118118
}),
119119
);
120120
});
@@ -240,7 +240,8 @@ describe("Mobile Phone Token verification: standard flow", () => {
240240
axios.mockImplementation(() =>
241241
Promise.resolve({
242242
status: 200,
243-
active: true,
243+
statusText: "OK",
244+
data: {active: true},
244245
}),
245246
);
246247

@@ -254,12 +255,12 @@ describe("Mobile Phone Token verification: standard flow", () => {
254255

255256
it("should not show error if active phone token returns 404", async () => {
256257
axios.mockReset();
257-
258+
258259
// Mock axios to handle sequential calls based on method
259260
axios.mockImplementation((config) => {
260261
const method = config.method?.toUpperCase();
261-
262-
if (method === 'GET') {
262+
263+
if (method === "GET") {
263264
// activePhoneToken - returns 404 (handled silently)
264265
return Promise.reject({
265266
response: {
@@ -270,7 +271,7 @@ describe("Mobile Phone Token verification: standard flow", () => {
270271
},
271272
},
272273
});
273-
} else if (method === 'POST') {
274+
} else if (method === "POST") {
274275
// createPhoneToken - succeeds
275276
return Promise.resolve({
276277
status: 201,
@@ -279,7 +280,7 @@ describe("Mobile Phone Token verification: standard flow", () => {
279280
});
280281
}
281282
});
282-
283+
283284
validateToken.mockResolvedValue(true);
284285
jest.spyOn(toast, "error");
285286

@@ -355,22 +356,22 @@ describe("Mobile Phone Token verification: standard flow", () => {
355356
it("should resend token successfully", async () => {
356357
jest.spyOn(toast, "info");
357358
validateToken.mockResolvedValue(true);
358-
359+
359360
// Reset and set up axios mock before rendering
360361
axios.mockReset();
361-
362+
362363
// Mock axios to handle sequential calls
363364
axios.mockImplementation((config) => {
364365
const method = config.method?.toUpperCase();
365-
366-
if (method === 'GET') {
366+
367+
if (method === "GET") {
367368
// activePhoneToken
368369
return Promise.resolve({
369370
status: 200,
370371
statusText: "OK",
371-
data: { active: false },
372+
data: {active: false},
372373
});
373-
} else if (method === 'POST') {
374+
} else if (method === "POST") {
374375
// createPhoneToken (both initial and resend)
375376
return Promise.resolve({
376377
status: 201,
@@ -379,7 +380,7 @@ describe("Mobile Phone Token verification: standard flow", () => {
379380
});
380381
}
381382
});
382-
383+
383384
props.userData = userData;
384385

385386
renderWithProviders(<MobilePhoneVerification {...props} />);
@@ -407,25 +408,25 @@ describe("Mobile Phone Token verification: standard flow", () => {
407408
it("should verify token successfully and must call setUserData", async () => {
408409
validateToken.mockResolvedValue(true);
409410
loadTranslation("en", "default");
410-
411+
411412
// Reset and set up axios mock
412413
axios.mockReset();
413-
414+
414415
// Track POST call count for sequential responses
415416
let postCallCount = 0;
416-
417+
417418
axios.mockImplementation((config) => {
418419
const method = config.method?.toUpperCase();
419-
420-
if (method === 'GET') {
420+
421+
if (method === "GET") {
421422
// activePhoneToken
422423
return Promise.resolve({
423424
status: 200,
424-
data: { active: false },
425+
data: {active: false},
425426
});
426-
} else if (method === 'POST') {
427+
} else if (method === "POST") {
427428
postCallCount += 1;
428-
429+
429430
if (postCallCount === 1) {
430431
// First POST: createPhoneToken
431432
return Promise.resolve({
@@ -443,7 +444,7 @@ describe("Mobile Phone Token verification: standard flow", () => {
443444
}
444445
}
445446
});
446-
447+
447448
props.userData = userData;
448449

449450
renderWithProviders(<MobilePhoneVerification {...props} />);
@@ -476,25 +477,25 @@ describe("Mobile Phone Token verification: standard flow", () => {
476477
it("should show errors", async () => {
477478
validateToken.mockResolvedValue(true);
478479
loadTranslation("en", "default");
479-
480+
480481
// Reset and set up axios mock
481482
axios.mockReset();
482-
483+
483484
// Track POST call count for sequential responses
484485
let postCallCount = 0;
485-
486+
486487
axios.mockImplementation((config) => {
487488
const method = config.method?.toUpperCase();
488-
489-
if (method === 'GET') {
489+
490+
if (method === "GET") {
490491
// activePhoneToken
491492
return Promise.resolve({
492493
status: 200,
493-
data: { active: false },
494+
data: {active: false},
494495
});
495-
} else if (method === 'POST') {
496+
} else if (method === "POST") {
496497
postCallCount += 1;
497-
498+
498499
if (postCallCount === 1) {
499500
// First POST: createPhoneToken succeeds
500501
return Promise.resolve({
@@ -516,7 +517,7 @@ describe("Mobile Phone Token verification: standard flow", () => {
516517
}
517518
}
518519
});
519-
520+
520521
props.userData = userData;
521522

522523
renderWithProviders(<MobilePhoneVerification {...props} />);
@@ -681,4 +682,4 @@ describe("Mobile Phone Token verification: corner cases", () => {
681682
// Should not proceed with verification if feature is disabled
682683
expect(axios).not.toHaveBeenCalled();
683684
});
684-
});
685+
});

client/components/organization-wrapper/organization-wrapper.test.js

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,16 @@ describe("<OrganizationWrapper /> rendering", () => {
247247
describe("<OrganizationWrapper /> interactions", () => {
248248
let props;
249249
let consoleErrorSpy;
250-
let lastConsoleOutuput;
250+
let lastConsoleOutput;
251251

252252
beforeEach(() => {
253253
jest.clearAllMocks();
254254
needsVerify.mockReturnValue(false);
255-
lastConsoleOutuput = null;
255+
lastConsoleOutput = null;
256256
consoleErrorSpy = jest
257257
.spyOn(global.console, "error")
258258
.mockImplementation((data) => {
259-
lastConsoleOutuput = data;
259+
lastConsoleOutput = data;
260260
});
261261
props = createTestProps();
262262
});
@@ -272,83 +272,83 @@ describe("<OrganizationWrapper /> interactions", () => {
272272
});
273273

274274
it("test componentDidUpdate lifecycle method", () => {
275-
const {rerender} = renderWithRouter(props);
275+
const {rerender} = renderWithRouter(props);
276276

277-
// Update with new organization
278-
const newProps = {
279-
...props,
280-
params: {organization: "new-org"},
281-
organization: {
282-
configuration: {
283-
title: undefined,
284-
css_path: "index.css",
285-
slug: "default",
286-
favicon: "favicon.png",
287-
default_language: "en",
288-
userData: {is_active: true, is_verified: true},
289-
components: {
290-
...defaultConfig.components,
291-
contact_page: {},
277+
// Update with new organization
278+
const newProps = {
279+
...props,
280+
params: {organization: "new-org"},
281+
organization: {
282+
configuration: {
283+
title: undefined,
284+
css_path: "index.css",
285+
slug: "default",
286+
favicon: "favicon.png",
287+
default_language: "en",
288+
userData: {is_active: true, is_verified: true},
289+
components: {
290+
...defaultConfig.components,
291+
contact_page: {},
292+
},
293+
languages: defaultConfig.languages,
292294
},
293-
languages: defaultConfig.languages,
295+
exists: true,
294296
},
295-
exists: true,
296-
},
297-
};
297+
};
298298

299-
const mockedStore = {
300-
subscribe: () => {},
301-
dispatch: () => {},
302-
getState: () => ({
303-
organization: {
304-
configuration: newProps.organization.configuration,
305-
},
306-
language: newProps.language || "en",
307-
}),
308-
};
299+
const mockedStore = {
300+
subscribe: () => {},
301+
dispatch: () => {},
302+
getState: () => ({
303+
organization: {
304+
configuration: newProps.organization.configuration,
305+
},
306+
language: newProps.language || "en",
307+
}),
308+
};
309309

310-
rerender(
311-
<HelmetProvider>
312-
<Provider store={mockedStore}>
313-
<MemoryRouter initialEntries={[newProps.location?.pathname || "/"]}>
314-
<OrganizationWrapper {...newProps} />
315-
</MemoryRouter>
316-
</Provider>
317-
</HelmetProvider>,
318-
);
310+
rerender(
311+
<HelmetProvider>
312+
<Provider store={mockedStore}>
313+
<MemoryRouter initialEntries={[newProps.location?.pathname || "/"]}>
314+
<OrganizationWrapper {...newProps} />
315+
</MemoryRouter>
316+
</Provider>
317+
</HelmetProvider>,
318+
);
319319

320-
expect(props.setOrganization).toHaveBeenCalledTimes(2);
320+
expect(props.setOrganization).toHaveBeenCalledTimes(2);
321321

322-
// Test with undefined params - reuse existing consoleErrorSpy from beforeEach
323-
const invalidProps = {
324-
...props,
325-
params: {organization: undefined},
326-
};
322+
// Test with undefined params - reuse existing consoleErrorSpy from beforeEach
323+
const invalidProps = {
324+
...props,
325+
params: {organization: undefined},
326+
};
327327

328-
const invalidMockedStore = {
329-
subscribe: () => {},
330-
dispatch: () => {},
331-
getState: () => ({
332-
organization: {
333-
configuration: invalidProps.organization.configuration,
334-
},
335-
language: invalidProps.language || "en",
336-
}),
337-
};
328+
const invalidMockedStore = {
329+
subscribe: () => {},
330+
dispatch: () => {},
331+
getState: () => ({
332+
organization: {
333+
configuration: invalidProps.organization.configuration,
334+
},
335+
language: invalidProps.language || "en",
336+
}),
337+
};
338338

339-
rerender(
340-
<HelmetProvider>
341-
<Provider store={invalidMockedStore}>
342-
<MemoryRouter>
343-
<OrganizationWrapper {...invalidProps} />
344-
</MemoryRouter>
345-
</Provider>
346-
</HelmetProvider>,
347-
);
339+
rerender(
340+
<HelmetProvider>
341+
<Provider store={invalidMockedStore}>
342+
<MemoryRouter>
343+
<OrganizationWrapper {...invalidProps} />
344+
</MemoryRouter>
345+
</Provider>
346+
</HelmetProvider>,
347+
);
348348

349-
expect(lastConsoleOutuput).not.toBe(null);
350-
expect(consoleErrorSpy).toHaveBeenCalledTimes(1);
351-
});
349+
expect(lastConsoleOutput).not.toBe(null);
350+
expect(consoleErrorSpy).toHaveBeenCalledTimes(1);
351+
});
352352

353353
it("should render main title if pageTitle is undefined", () => {
354354
const {container} = renderWithRouter(props);
@@ -687,19 +687,19 @@ describe("Test <OrganizationWrapper /> routes", () => {
687687
});
688688

689689
it("should handle 404 routes", async () => {
690-
const {container} = mountComponent(props, ["/default/non-existent-route"]);
690+
const {container} = mountComponent(props, ["/default/non-existent-route"]);
691691

692-
await waitFor(() => {
693-
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
694-
expect(container.querySelector(".app-container")).toBeInTheDocument();
695-
});
692+
await waitFor(() => {
693+
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
694+
expect(container.querySelector(".app-container")).toBeInTheDocument();
695+
});
696696

697-
// Should show 404 page content
698-
await waitFor(() => {
699-
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
700-
expect(container.querySelector("#not-foud-404")).toBeInTheDocument();
697+
// Should show 404 page content
698+
await waitFor(() => {
699+
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
700+
expect(container.querySelector("#not-foud-404")).toBeInTheDocument();
701+
});
701702
});
702-
});
703703

704704
it("should load header and footer on all routes", async () => {
705705
const {container} = mountComponent(props, ["/default/status"]);

0 commit comments

Comments
 (0)