Skip to content

Commit 6ccfc0f

Browse files
linting
1 parent e5a81fa commit 6ccfc0f

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

condition-web/.eslintrc.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ module.exports = {
1515
{ allowConstantExport: true },
1616
],
1717
"no-console": "error",
18+
"@typescript-eslint/no-unused-vars": [
19+
"error",
20+
{ ignoreRestSiblings: true },
21+
],
1822
},
1923
};

condition-web/cypress/utils/mockConstants.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { EPIC_CONDITION_ROLE } from "../../src/models/Role";
2+
import { mockAccessToken } from "./testUtils";
23

34

45
export const mockAuthentication = {
@@ -13,7 +14,7 @@ export const mockAuthentication = {
1314
exp: Math.floor(Date.now() / 1000) + 3600,
1415
iat: Math.floor(Date.now() / 1000),
1516
},
16-
access_token: "test_access_token",
17+
access_token: mockAccessToken,
1718
session_state: "mock_session_state",
1819
token_type: "Bearer",
1920
state: {},

condition-web/cypress/utils/testUtils.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,13 @@ export const mockZustandStore = (storeModule, initialState) => {
1111
};
1212
};
1313

14-
export const setupTokenStorage = () => {
15-
sessionStorage.setItem(
16-
`oidc.user:${OidcConfig.authority}:${OidcConfig.client_id}`,
17-
JSON.stringify({
18-
access_token:
19-
"eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJleHAiOjE3NTE2Njk5MjUsImlhdCI6MTc1MTY2NjMyNSwiYXV0aF90aW1lIjoxNzUxNjY2MzI1LCJqdGkiOiIiLCJpc3MiOiJodHRwczovL3Rlc3QtaXNzdWVyIiwiYXVkIjpbImVwaWMtY29uZGl0aW9uIiwiYWNjb3VudCJdLCJzdWIiOiJ0ZXN0LXN1YiIsInR5cCI6IkJlYXJlciIsImF6cCI6ImVwaWMtY29uZGl0aW9uIiwic2lkIjoiIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJlYW9fdmlldyJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImVwaWMtY29uZGl0aW9uIjp7InJvbGVzIjpbInZpZXdfY29uZGl0aW9ucyJdfX0sInNjb3BlIjoib3BlbmlkIHByb2ZpbGUgZW1haWwiLCJpZGVudGl0eV9wcm92aWRlciI6ImlkaXIiLCJlbWFpbF92ZXJpZmllZCI6ZmFsc2UsIm5hbWUiOiJFQU8gVEVTVDIiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJAYWRpciIsImdpdmVuX25hbWUiOiJFQU8iLCJmYW1pbHlfbmFtZSI6IlRFU1QyIn0.",
20-
}),
21-
);
22-
};
23-
24-
2514
// Helper to encode object to base64url
2615
const base64Url = (obj: Record<string, unknown>) => {
2716
const json = JSON.stringify(obj);
2817
const base64 = btoa(json);
2918
return base64.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
3019
};
31-
20+
3221
// Create dummy JWT
3322
const payload = {
3423
exp: Math.floor(Date.now() / 1000) + 3600,
@@ -40,11 +29,20 @@ const payload = {
4029
},
4130
},
4231
};
43-
44-
const mockAccessToken = `${base64Url({ alg: "RS256", typ: "JWT" })}.${base64Url(
32+
33+
export const mockAccessToken = `${base64Url({ alg: "RS256", typ: "JWT" })}.${base64Url(
4534
payload
4635
)}.signature`;
47-
36+
37+
export const setupTokenStorage = () => {
38+
sessionStorage.setItem(
39+
`oidc.user:${OidcConfig.authority}:${OidcConfig.client_id}`,
40+
JSON.stringify({
41+
access_token: mockAccessToken,
42+
}),
43+
);
44+
};
45+
4846
export const mockAuth = {
4947
isAuthenticated: true,
5048
user: {
@@ -68,5 +66,5 @@ export const mockAuth = {
6866
client_id: OidcConfig.client_id,
6967
redirect_uri: "http://localhost/callback",
7068
},
71-
events: {} as Record<string, (...args: unknown[]) => void>,
69+
events: {} as Record<string, (...args: unknown[]) => void>,
7270
};

condition-web/src/components/ConditionDetails/CreateCondition/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const CreateConditionPage = ({
116116
}
117117

118118
try {
119-
const { condition_id: _id, condition_attributes: _attrs, ...data } = condition;
119+
const { condition_id, condition_attributes, ...data } = condition;
120120
const response = await saveCondition({ conditionDetails: data, allowDuplicateCondition });
121121
if (response) {
122122
notify.success("Condition created successfully");

0 commit comments

Comments
 (0)