Skip to content

Commit 98b5020

Browse files
fix: layout test case
1 parent 27c115f commit 98b5020

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

code/frontend/src/pages/layout/Layout.test.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* @jest-environment jsdom
3+
* @jest-environment-options {"url": "http://NonDeloyed/"}
4+
*/
5+
16
import {
27
render,
38
screen,
@@ -66,11 +71,8 @@ describe("Layout Component", () => {
6671

6772
test('test the auth branching auth is true case', async () => {
6873
const mocklist: any[] = [];
69-
Object.defineProperty(window, "location", {
70-
value: {
71-
hostname: "NonDeloyed"
72-
},
73-
});
74+
75+
// Test with jsdom environment configured for NonDeloyed hostname
7476
;(getUserInfo as jest.Mock).mockResolvedValue(mocklist)
7577
;(checkAuthEnforced as jest.Mock).mockResolvedValue(true)
7678
await act(async () => {

0 commit comments

Comments
 (0)