Skip to content

Commit

Permalink
Execute tests in CI
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michalinacienciala committed Dec 6, 2023
1 parent 6601946 commit ab30cbb
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 43 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/dashboard-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
81 changes: 41 additions & 40 deletions src/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit ab30cbb

Please sign in to comment.