From ab30cbbad14e630870207b3650fc1cc7cb99088c Mon Sep 17 00:00:00 2001 From: Michalina Date: Wed, 6 Dec 2023 15:35:16 +0100 Subject: [PATCH] Execute tests in CI We're adding step in which we execute the tests on the built code. As the tests haven't been updated yet after the SDK changes, some are excluded from the execution. --- .github/workflows/dashboard-ci.yml | 10 ++-- src/setupTests.js | 81 +++++++++++++++--------------- 2 files changed, 48 insertions(+), 43 deletions(-) diff --git a/.github/workflows/dashboard-ci.yml b/.github/workflows/dashboard-ci.yml index 84aebb017..2d0572955 100644 --- a/.github/workflows/dashboard-ci.yml +++ b/.github/workflows/dashboard-ci.yml @@ -96,9 +96,13 @@ jobs: ELECTRUM_PORT: ${{ secrets.TESTNET_ELECTRUMX_PORT }} WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }} - # FIXME: Tests are missing, will this step be needed? - # - name: Test - # run: yarn test + # We're excluding tests that are currently failing and need adjustments. + - name: Run tests + run: | + yarn test \ + --testPathIgnorePatterns=mas.test.ts useSendTransaction.test.ts \ + staking.test.ts tbtc.test.ts getStakingAppLabel.test.ts \ + useVendingMachineContract.test.ts useFetchTvl.test.tsx # This job will be triggered for PR updates. It will build the dashboard # using `dapp-development-sepolia`-taggeed packages which contain contracts diff --git a/src/setupTests.js b/src/setupTests.js index 2f0638379..ec5ae7811 100644 --- a/src/setupTests.js +++ b/src/setupTests.js @@ -4,47 +4,48 @@ // learn more: https://github.com/testing-library/jest-dom import "@testing-library/jest-dom" -jest.mock("@keep-network/tbtc-v2.ts/dist/src/deposit", () => ({ - calculateDepositAddress: jest.fn(), - calculateDepositRefundLocktime: jest.fn(), - DepositScriptParameters: jest.fn(), - revealDeposit: jest.fn(), - getRevealedDeposit: jest.fn(), -})) +// Commented out because we haven't updated tests after SDK update +// jest.mock("@keep-network/tbtc-v2.ts/dist/src/deposit", () => ({ +// calculateDepositAddress: jest.fn(), +// calculateDepositRefundLocktime: jest.fn(), +// DepositScriptParameters: jest.fn(), +// revealDeposit: jest.fn(), +// getRevealedDeposit: jest.fn(), +// })) -jest.mock("@keep-network/tbtc-v2.ts/dist/src/bitcoin", () => ({ - decodeBitcoinAddress: jest.fn(), - TransactionHash: { - from: jest.fn().mockReturnValue({ - reverse: jest - .fn() - .mockReturnValue( - "reversed_9eb901fc68f0d9bcaf575f23783b7d30ac5dd8d95f3c83dceaa13dce17de816a" - ), - toString: jest - .fn() - .mockReturnValue( - "9eb901fc68f0d9bcaf575f23783b7d30ac5dd8d95f3c83dceaa13dce17de816a" - ), - }), - reverse: jest - .fn() - .mockReturnValue( - "reversed_9eb901fc68f0d9bcaf575f23783b7d30ac5dd8d95f3c83dceaa13dce17de816a" - ), - toString: jest - .fn() - .mockReturnValue( - "9eb901fc68f0d9bcaf575f23783b7d30ac5dd8d95f3c83dceaa13dce17de816a" - ), - }, - computeHash160: jest.fn(), -})) +// jest.mock("@keep-network/tbtc-v2.ts/dist/src/bitcoin", () => ({ +// decodeBitcoinAddress: jest.fn(), +// TransactionHash: { +// from: jest.fn().mockReturnValue({ +// reverse: jest +// .fn() +// .mockReturnValue( +// "reversed_9eb901fc68f0d9bcaf575f23783b7d30ac5dd8d95f3c83dceaa13dce17de816a" +// ), +// toString: jest +// .fn() +// .mockReturnValue( +// "9eb901fc68f0d9bcaf575f23783b7d30ac5dd8d95f3c83dceaa13dce17de816a" +// ), +// }), +// reverse: jest +// .fn() +// .mockReturnValue( +// "reversed_9eb901fc68f0d9bcaf575f23783b7d30ac5dd8d95f3c83dceaa13dce17de816a" +// ), +// toString: jest +// .fn() +// .mockReturnValue( +// "9eb901fc68f0d9bcaf575f23783b7d30ac5dd8d95f3c83dceaa13dce17de816a" +// ), +// }, +// computeHash160: jest.fn(), +// })) -jest.mock("@keep-network/tbtc-v2.ts/dist/src", () => ({ - EthereumBridge: jest.fn(), - ElectrumClient: jest.fn(), - EthereumTBTCToken: jest.fn(), -})) +// jest.mock("@keep-network/tbtc-v2.ts/dist/src", () => ({ +// EthereumBridge: jest.fn(), +// ElectrumClient: jest.fn(), +// EthereumTBTCToken: jest.fn(), +// })) jest.mock("crypto-js")