Skip to content

Commit 323a42b

Browse files
committed
Fix for cannot be used as a JSX Component react error
Mocks updated to suddenly changed firebase interface change Small fixes
1 parent d21d5d2 commit 323a42b

File tree

8 files changed

+2200
-2125
lines changed

8 files changed

+2200
-2125
lines changed

configurator/frontend/main/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
"ws": "^8.2.3",
7878
"tar": "^6.1.11",
7979
"nth-check": "^2.0.1",
80-
"browserslist": "^4.17.3"
80+
"browserslist": "^4.17.3",
81+
"@types/react": "^17.0.47",
82+
"@types/react-dom": "^17.0.17"
8183
}
8284
}

configurator/frontend/main/src/__mocks__/firebase/__mockUser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export type MockFirebaseUser = Pick<User, keyof UserFields | "getIdTokenResult">
77

88
export const mockUser: MockFirebaseUser = {
99
...mockUserFields,
10-
getIdTokenResult: jest.fn(() => Promise.resolve(mockTokenInfo)),
10+
getIdTokenResult: jest.fn((forceRefresh?) => Promise.resolve(mockTokenInfo)),
1111
}

configurator/frontend/main/src/__mocks__/firebase/_mockTokenInfo.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { IdTokenResult } from "firebase/auth"
2+
13
const now = Date.now()
24
const plusHour = now + 3_600_000
35

@@ -29,4 +31,4 @@ export const mockTokenInfo = {
2931
sign_in_provider: "password",
3032
},
3133
},
32-
}
34+
} as unknown as IdTokenResult

configurator/frontend/main/src/__mocks__/firebase/app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// jest.requireActual('firebase');
2+
import { MockFirebaseUser, mockUser } from "./__mockUser"
3+
24
jest.unmock("firebase/auth")
35
jest.unmock("firebase/app")
46
import { FirebaseApp } from "firebase/app"
57
import firebase from "firebase/auth"
6-
import { mockUser, MockFirebaseUser } from "./__mockUser"
78

89
/**
910
* need to mock:

configurator/frontend/main/src/lib/components/BilledButton/BilledButton.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export const BilledButton: React.FC<Props> = ({
3030
const currentPlan = useServices().currentSubscription.currentPlan
3131
const isButtonBlocked = useMemo<boolean>(() => {
3232
if (currentPlan.id === "opensource") return false
33-
return isBlocked ?? plansBlacklist?.includes(currentPlan.id) ?? !plansWhitelist?.includes(currentPlan.id) ?? false
33+
const blackList = plansBlacklist ?? []
34+
const whiteList = plansWhitelist ?? []
35+
return isBlocked ?? blackList.includes(currentPlan.id) ?? !whiteList.includes(currentPlan.id) ?? false
3436
}, [isBlocked, currentPlan])
3537

3638
const Wrapper = isButtonBlocked

configurator/frontend/main/src/lib/components/EntityIcon/EntityIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type ApiKeyIconProps = {
2222
entitySubType?: undefined
2323
}
2424

25-
const EntityIconComponent: React.FC<EntityIconProps> = ({ entityType, entitySubType }) => {
25+
const EntityIconComponent = ({ entityType, entitySubType = undefined }: EntityIconProps) => {
2626
switch (entityType) {
2727
case "source":
2828
return allSourcesMap[entitySubType]?.pic || null

configurator/frontend/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"test": "lerna run test --stream",
1010
"clean": "rm -rf ./node_modules ./main/node_modules/ ./main/build ./main/dist",
1111
"reset": "yarn clean && yarn install",
12-
"reset:full": "yarn reset && rm -rf yarn.lock ./main/yarn.lock ./catalog/yarn.lock",
12+
"reset:full": "yarn clean && rm -rf yarn.lock ./main/yarn.lock ./catalog/yarn.lock",
1313
"lerna:publish": "lerna publish --canary --no-private --no-verify-access --yes",
1414
"prettier:check": "prettier --check --config ./.prettierrc.json --ignore-path ./.prettierignore ./ || (echo \"👉 Run yarn prettier:fix!\" && exit 1)",
1515
"prettier:fix": "prettier --write --config ./.prettierrc.json --ignore-path ./.prettierignore ./",
@@ -45,8 +45,8 @@
4545
"@types/lodash": "^4.14.168",
4646
"@types/lodash-es": "^4.17.4",
4747
"@types/node": "^12.0.0",
48-
"@types/react": "^17.0.0",
49-
"@types/react-dom": "^17.0.0",
48+
"@types/react": "^17.0.47",
49+
"@types/react-dom": "^17.0.17",
5050
"@types/react-router-dom": "^5.1.7",
5151
"autoprefixer": "^9",
5252
"babel-plugin-lodash": "^3.3.4",
@@ -65,11 +65,13 @@
6565
"tailwindcss": "npm:@tailwindcss/postcss7-compat",
6666
"terser-webpack-plugin": "^5.1.1",
6767
"ts-jest": "^27.0.3",
68-
"typescript": "^4.4.3",
68+
"typescript": "^4.7.4",
6969
"web-vitals": "^1.0.1",
7070
"webpack-bundle-analyzer": "^4.4.0"
7171
},
7272
"resolutions": {
73-
"react-error-overlay": "6.0.9"
73+
"react-error-overlay": "6.0.9",
74+
"@types/react": "^17.0.47",
75+
"@types/react-dom": "^17.0.17"
7476
}
7577
}

configurator/frontend/yarn.lock

Lines changed: 2180 additions & 2114 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)