Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
steezeburger committed Dec 11, 2024
1 parent d673211 commit c63999e
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ web/build
# gcloud
gsa-key.json

# ai digest
# ai digest for feeding to LLMs
codebase.md
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ mod web

_default:
@just --list

# generate codebase.md that is useful to feed to LLMs
[group('extra')]
ai-digest:
npx ai-digest -i web --show-output-files
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"analyze": "source-map-explorer 'build/static/js/*.js'",
"test": "react-app-rewired test --transformIgnorePatterns \"/node_modules/(?!(@cosmjs|axios|@rainbow-me/rainbowkit|wagmi|@wagmi)/)\"",
"test": "react-app-rewired test --transformIgnorePatterns \"/node_modules/(?!(@cosmjs|axios|@rainbow-me/rainbowkit|wagmi|@wagmi))/\"",
"test-cov": "CI=true react-scripts test --coverage",
"eject": "react-scripts eject",
"format": "biome format --write .",
Expand Down
8 changes: 4 additions & 4 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type React from "react";
import { Route, Routes } from "react-router-dom";
import { ChainProvider } from "@cosmos-kit/react";
import { assets, chains } from "chain-registry";
import { wallets } from "@cosmos-kit/keplr";
import { wallets as keplrWallets } from "@cosmos-kit/keplr";
import { wallets as leapWallets } from "@cosmos-kit/leap";
import type { Chain } from "@chain-registry/types";
import { getDefaultConfig, RainbowKitProvider } from "@rainbow-me/rainbowkit";
Expand Down Expand Up @@ -57,9 +57,9 @@ export default function App(): React.ReactElement {
<QueryClientProvider client={queryClient}>
<RainbowKitProvider>
<ChainProvider
assetLists={[...assets, ...cosmosAssetLists]} // supported asset lists
chains={[...chains, ...cosmosChains]} // supported chains
wallets={[...wallets, ...leapWallets]} // supported wallets
assetLists={[...assets, ...cosmosAssetLists]}
chains={[...chains, ...cosmosChains]}
wallets={[...keplrWallets, ...leapWallets]}
walletConnectOptions={cosmosWalletConnectOptions} // required if `wallets` contains mobile wallets
signerOptions={{
preferredSignType: (chain: string | Chain) => {
Expand Down
42 changes: 42 additions & 0 deletions web/src/setupTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,45 @@ jest.mock("wagmi", () => {
})),
};
});

// mock osmojs
jest.mock("osmojs", () => ({
osmosis: {
ClientFactory: {
createRPCQueryClient: jest.fn(() => ({
cosmos: {
bank: {
v1beta1: {
balance: jest.fn(() => ({
balance: { amount: "1000000", denom: "utia" }
}))
}
}
}
}))
}
}
}));

// mock chain-registry
jest.mock("chain-registry", () => ({
assets: [],
chains: []
}));

// mock all cosmos-kit related packages
jest.mock("@cosmos-kit/keplr", () => ({
wallets: [{
name: "keplr",
prettyName: "Keplr",
mode: "extension"
}]
}));

jest.mock("@cosmos-kit/leap", () => ({
wallets: [{
name: "leap",
prettyName: "Leap",
mode: "extension"
}]
}));

0 comments on commit c63999e

Please sign in to comment.