Skip to content

Commit b8d8c7e

Browse files
committed
refactor(core): fix unit tests
1 parent 83d4c60 commit b8d8c7e

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

packages/core/src/ui/components/Activity/__tests__/AssetActivityItem.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Testing AssetActivityItem component', () => {
6565
const { findByTestId } = render(<AssetActivityItem {...props} />);
6666

6767
const activityAmount = await findByTestId(assetsAmountTestId);
68-
const tickerText = `-${props.amount}, ${props.assets[0].val} ${props.assets[0].info.ticker}`;
68+
const tickerText = `-${props.amount}, ${props.assets?.[0].val} ${props.assets?.[0].info?.ticker}`;
6969
const activityAssetTickerText = await within(activityAmount).findByText(tickerText);
7070

7171
expect(activityAssetTickerText).toBeVisible();

packages/core/src/ui/components/Password/__tests__/Password.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ describe('Password', () => {
2525
(input as HTMLInputElement).value = 'admin123';
2626
expect(input).toHaveProperty('type', 'password');
2727
act(() => {
28-
fireEvent.click(queryByTestId('password-input-show-icon'));
28+
const icon = queryByTestId('password-input-show-icon');
29+
icon && fireEvent.click(icon);
2930
});
3031
expect(input).toHaveProperty('type', 'text');
3132
expect(input).toHaveValue('admin123');
@@ -36,11 +37,13 @@ describe('Password', () => {
3637
(input as HTMLInputElement).value = 'admin123';
3738
expect(input).toHaveProperty('type', 'password');
3839
act(() => {
39-
fireEvent.click(queryByTestId('password-input-show-icon'));
40+
const icon = queryByTestId('password-input-show-icon');
41+
icon && fireEvent.click(icon);
4042
});
4143
expect(input).toHaveProperty('type', 'text');
4244
act(() => {
43-
fireEvent.click(queryByTestId('password-input-hide-icon'));
45+
const icon = queryByTestId('password-input-hide-icon');
46+
icon && fireEvent.click(icon);
4447
});
4548
expect(input).toHaveProperty('type', 'password');
4649
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
process.env.CARDANO_SERVICES_URL_PREVIEW = 'https://preview-prod.com';
2+
process.env.CARDANO_SERVICES_URL_PREPROD = 'https://preprod-prod.com';
3+
process.env.CARDANO_SERVICES_URL_MAINNET = 'https://mainnet-url.com';
4+
process.env.CARDANO_SERVICES_URL_SANCHONET = 'https://sanchonet-url.com';
5+
process.env.BLOCKFROST_URL_MAINNET = 'https://cardano-mainnet.blockfrost.io';
6+
process.env.BLOCKFROST_URL_PREPROD = 'https://cardano-preprod.blockfrost.io';
7+
process.env.BLOCKFROST_URL_PREVIEW = 'https://cardano-preview.blockfrost.io';
8+
process.env.BLOCKFROST_URL_SANCHONET = 'https://cardano-sanchonet.blockfrost.io';
9+
process.env.BLOCKFROST_PROJECT_ID_MAINNET = 'mainnetprojectid';
10+
process.env.BLOCKFROST_PROJECT_ID_PREPROD = 'preprodprojectid';
11+
process.env.BLOCKFROST_PROJECT_ID_PREVIEW = 'previewprojectid';
12+
process.env.BLOCKFROST_PROJECT_ID_SANCHONET = 'sanchonet...TODO';
13+
process.env.AVAILABLE_CHAINS = 'Preprod,Preview,Mainnet,Sanchonet';
14+
process.env.CEXPLORER_URL_MAINNET = 'https://cexplorer.io';
15+
process.env.CEXPLORER_URL_PREVIEW = 'https://preview.cexplorer.io';
16+
process.env.CEXPLORER_URL_PREPROD = 'https://preprod.cexplorer.io';
17+
process.env.CEXPLORER_URL_SANCHONET = 'https://sanchonet.cexplorer.io';
18+
process.env.USE_HIDE_MY_BALANCE = 'true';
19+
process.env.USE_POSTHOG_ANALYTICS = 'true';
20+
process.env.USE_POSTHOG_ANALYTICS_FOR_OPTED_OUT = 'false';
21+
process.env.POSTHOG_HOST = 'https://e.lw.iog.io';
22+
process.env.POSTHOG_DEV_TOKEN = 'test-token';
23+
process.env.MIN_NUMBER_OF_COSIGNERS = '2';
24+
process.env.TWITTER_URL = 'TWITTER_URL';
25+
process.env.YOUTUBE_URL = 'YOUTUBE_URL';
26+
process.env.DISCORD_URL = 'DISCORD_URL';

packages/core/test/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ module.exports = createJestConfig({
1313
roots: ['<rootDir>/src'],
1414
testTimeout: 60000,
1515
testEnvironment: 'jsdom',
16+
setupFiles: ['<rootDir>/test/__mocks__/set-env-vars.js'],
1617
setupFilesAfterEnv: ['./test/jest.setup.js', 'jest-canvas-mock']
1718
});

0 commit comments

Comments
 (0)