Skip to content

Commit 1b68f1c

Browse files
committed
[DDW-596] fix broken tests
1 parent 008403d commit 1b68f1c

File tree

4 files changed

+540
-618
lines changed

4 files changed

+540
-618
lines changed

jest.config.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,28 @@ module.exports = {
170170
// testRunner: "jest-circus/runner",
171171

172172
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
173-
// testURL: "http://localhost",
173+
// testURL: 'http://localhost/',
174174

175175
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
176176
// timers: "real",
177177

178178
// A map from regular expressions to paths to transformers
179179
transform: {
180-
'\\.[jt]sx?$': 'babel-jest',
181-
'^.+\\.svg$': 'jest-svg-transformer',
180+
'^.+\\.(t|j)sx?$': [
181+
'@swc/jest',
182+
{
183+
jsc: {
184+
parser: {
185+
syntax: 'typescript',
186+
tsx: true,
187+
decorators: true,
188+
},
189+
target: 'es2019',
190+
loose: false,
191+
},
192+
},
193+
],
194+
'^.+\\.svg$': 'svg-jest',
182195
'.+\\.(css|styl|less|sass|scss)$': 'jest-css-modules-transform',
183196
},
184197

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@
9696
"@storybook/manager-webpack5": "6.4.22",
9797
"@storybook/react": "6.4.22",
9898
"@swc-node/register": "1.4.2",
99-
"@swc/core": "1.2.164",
99+
"@swc/core": "1.2.181",
100+
"@swc/jest": "0.2.21",
100101
"@testing-library/jest-dom": "5.15.1",
101102
"@testing-library/react": "12.1.2",
102103
"@types/aes-js": "3.1.1",
@@ -148,10 +149,9 @@
148149
"https-browserify": "1.0.0",
149150
"husky": "4.3.0",
150151
"identity-obj-proxy": "3.0.0",
151-
"jest": "26.6.3",
152-
"jest-css-modules-transform": "4.3.0",
153-
"jest-environment-jsdom": "26.6.2",
154-
"jest-svg-transformer": "1.0.0",
152+
"jest": "27.5.1",
153+
"jest-css-modules-transform": "4.4.2",
154+
"jest-environment-jsdom": "27.5.1",
155155
"markdown-loader": "7.0.0",
156156
"mini-css-extract-plugin": "2.3.0",
157157
"minimist": "1.2.6",
@@ -182,6 +182,7 @@
182182
"stylelint": "13.7.2",
183183
"stylelint-order": "4.1.0",
184184
"svg-inline-loader": "0.8.2",
185+
"svg-jest": "1.0.1",
185186
"swc-loader": "0.1.15",
186187
"thread-loader": "2.1.3",
187188
"timemachine": "0.3.2",
@@ -287,8 +288,8 @@
287288
"tcp-port-used": "1.0.1",
288289
"trezor-connect": "8.2.4-extended",
289290
"unorm": "1.6.0",
290-
"usb-detection": "4.13.0",
291291
"url": "0.11.0",
292+
"usb-detection": "4.13.0",
292293
"util": "0.12.4",
293294
"validator": "13.7.0"
294295
},

source/renderer/app/features/discreet-mode/feature.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,26 @@ import type { ReplacerFn } from './types';
88

99
export class DiscreetMode extends Feature {
1010
api: DiscreetModeApi;
11+
12+
constructor(api: DiscreetModeApi) {
13+
super();
14+
this.api = api;
15+
this.getDiscreetModeSettingsRequest = new Request(
16+
this.api.getDiscreetModeSettings
17+
);
18+
this.setDiscreetModeSettingsRequest = new Request(
19+
this.api.setDiscreetModeSettings
20+
);
21+
}
22+
1123
@observable
1224
isDiscreetMode = false;
1325
@observable
1426
openInDiscreetMode = false;
1527
@observable
16-
getDiscreetModeSettingsRequest: Request<Promise<boolean>> = new Request(
17-
// @ts-ignore ts-migrate(2729) FIXME: Property 'api' is used before its initialization.
18-
this.api.getDiscreetModeSettings
19-
);
28+
getDiscreetModeSettingsRequest: Request<Promise<boolean>>;
2029
@observable
21-
setDiscreetModeSettingsRequest: Request<Promise<boolean>> = new Request(
22-
// @ts-ignore ts-migrate(2729) FIXME: Property 'api' is used before its initialization.
23-
this.api.setDiscreetModeSettings
24-
);
25-
26-
constructor(api: DiscreetModeApi) {
27-
super();
28-
this.api = api;
29-
}
30+
setDiscreetModeSettingsRequest: Request<Promise<boolean>>;
3031

3132
async start() {
3233
super.start();

0 commit comments

Comments
 (0)