Skip to content

Commit

Permalink
fix: unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszjasiuk committed Nov 25, 2024
1 parent ebc47b3 commit dd3a3ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/namadillo/src/registry/namadaAsset.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { Asset } from "@chain-registry/types";
import { localnetConfigAtom } from "atoms/integrations";
import { localnetConfigAtom } from "atoms/integrations/atoms";
import { getDefaultStore } from "jotai";
import namadaShieldedSvg from "./assets/namada-shielded.svg";

const ADDRESS = "tnam1qxp7u2vmlgcrpn9j0ml7hrtr79g2w2fdesteh7tu";

// We can't return "satisfies Asset" from fn
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const namadaAsset = () => {
const store = getDefaultStore();
const config = store.get(localnetConfigAtom);
const localNamAddress = config.data?.tokenAddress;
const address = config.data?.tokenAddress || ADDRESS;

return {
name: "Namada",
base: "unam",
address: localNamAddress || "tnam1qxp7u2vmlgcrpn9j0ml7hrtr79g2w2fdesteh7tu",
address,
display: "nam",
symbol: "NAM",
denom_units: [
Expand Down
5 changes: 5 additions & 0 deletions apps/namadillo/src/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import "@testing-library/jest-dom";
import { atom } from "jotai";

jest.mock("atoms/integrations", () => ({
getRestApiAddressByIndex: jest.fn(),
getRpcByIndex: jest.fn(),
}));

jest.mock("atoms/integrations/atoms", () => ({
localnetConfigAtom: atom({ data: undefined }),
}));

0 comments on commit dd3a3ae

Please sign in to comment.