Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
5a65aaa
test: enhance balance story tests with loading and balance checks
kenyiu Apr 10, 2025
d863b71
fix: clean up import statements and improve code formatting in Balanc…
kenyiu Apr 10, 2025
ec96d86
test: remove unused imports and add avatar story play functions
kenyiu Apr 10, 2025
47538e2
fix: update AvatarWagmi component to include mainnet configuration
kenyiu Apr 10, 2025
5cfa3c2
test: add play function to EnsWagmi story for avatar loading verifica…
kenyiu Apr 10, 2025
99671bf
test: add play functions to AddressBadge stories for address and tool…
kenyiu Apr 10, 2025
9295fc6
fix: reorder import statements and correct regex formatting in Addres…
kenyiu Apr 10, 2025
d8ec3c2
test: test for name stories
kenyiu Apr 10, 2025
ce4e762
fix: reorder import statements in Name stories for consistency
kenyiu Apr 10, 2025
2e98de3
fix: add chainId to token fetching logic for improved token info retr…
kenyiu Apr 10, 2025
7bf7878
Merge branch 'draft' into fix/story-test
kenyiu Apr 10, 2025
334050d
refactor: extract avatar and name rendering tests into helper functio…
kenyiu Apr 10, 2025
2355de4
refactor: remove unnecessary comments from name rendering test for cl…
kenyiu Apr 10, 2025
225299a
refactor: streamline canvas setup in Storybook tests and enhance Name…
kenyiu Apr 10, 2025
ed27de6
refactor: simplify code formatting in TokenPriceChart and test-utils …
kenyiu Apr 10, 2025
91e0a2d
refactor: remove unnecessary comments from setupCanvas function for c…
kenyiu Apr 10, 2025
860eed7
refactor: remove commented checks and update token display logic in A…
kenyiu Apr 10, 2025
b992f7d
refactor: remove unnecessary whitespace and improve token symbol form…
kenyiu Apr 10, 2025
8d1ab7d
refactor: add testTokenChip utility function for improved token chip …
kenyiu Apr 11, 2025
ab3fb87
refactor: reorganize imports and improve formatting in TokenChipWithI…
kenyiu Apr 11, 2025
e14c760
refactor: remove redundant argument checks in ETHTokenChip stories
kenyiu Apr 11, 2025
3027412
fix: #126 (#126)
debuggingfuture Apr 11, 2025
3ee448c
refactor: simplify token chip story play functions and standardize cu…
kenyiu Apr 11, 2025
476aef2
refactor: standardize string quotes in TokenChipWithInfo stories
kenyiu Apr 11, 2025
d747736
refactor: remove redundant transaction_types from VITALIK_DEPOSIT fix…
kenyiu Apr 11, 2025
db12cf8
refactor: remove redundant transaction_types from VITALIK_TRANSFER fi…
kenyiu Apr 11, 2025
2c5e718
refactor: standardize vitest versioning across package.json files
kenyiu Apr 11, 2025
6c99c38
refactor: remove caret (^) from vitest version specifiers in pnpm-loc…
kenyiu Apr 11, 2025
07eda57
Merge branch 'draft' into fix/story-test
kenyiu Apr 11, 2025
84af11f
fix: gen pnpm lock file again
kenyiu Apr 11, 2025
3b17804
fix: increase timeout for avatar rendering test
kenyiu Apr 11, 2025
5d15d30
chore: update vitest version to 2.1.9 across all packages
kenyiu Apr 11, 2025
05effa5
fix: remove unnecessary vitest reference from vite.config.ts
kenyiu Apr 11, 2025
0c9ab08
Merge branch 'draft' into fix/story-test
kenyiu Apr 11, 2025
6c6a9fb
test: increase timeout for avatar rendering test
kenyiu Apr 11, 2025
de8646d
chore: upgrade vitest to version 3.1.1 across all packages and remove…
kenyiu Apr 11, 2025
6b9c144
test: add settings for fakeTimers for vitest2 behaviour
kenyiu Apr 11, 2025
aa6dc82
test: add reusable test function for TokenChip component
kenyiu Apr 11, 2025
6f0417e
fix: remove duplicate import of expect in TokenChip stories
kenyiu Apr 11, 2025
e36d75f
test: add testCodecForm utility function for CodecForm stories
kenyiu Apr 11, 2025
d19e132
fix: reorder imports in CodecForm stories for consistency
kenyiu Apr 11, 2025
ed32c8f
test: enhance ProjectMetricsGrid and ProjectTimeSeriesChart stories w…
kenyiu Apr 11, 2025
830f544
test: add display tests for PassportScoreCard component
kenyiu Apr 11, 2025
fdb6621
test: add play function to PrivyLogin stories for button presence ver…
kenyiu Apr 11, 2025
00d877c
test: add test for RevenueChart and add data-testid for visibility check
kenyiu Apr 11, 2025
9f3a369
test: enhance SignatureForm stories with additional play functions an…
kenyiu Apr 12, 2025
94afeb3
test: enhance SignatureFormMin stories with UI interaction tests and …
kenyiu Apr 12, 2025
6f3ea67
test: increase timeout values for storybook tests to improve reliability
kenyiu Apr 12, 2025
65e0a52
test: add interaction tests for FollowerListEnsjs component
kenyiu Apr 12, 2025
0c181c3
test: add play function to Address story for NameAndFollowerCountBadg…
kenyiu Apr 12, 2025
3a07d12
Merge branch 'draft' into fix/story-test
kenyiu Apr 12, 2025
659994e
fix: update wagmi configuration and improve mock setup in tests
kenyiu Apr 12, 2025
2373d09
Merge branch 'draft' into fix/story-test
kenyiu Apr 12, 2025
8f4f3ef
fix: increase timeout in testFollowerListDisplay for better reliability
kenyiu Apr 12, 2025
fb46cb0
fix: update shadcn dependency version to 2.4.0
kenyiu Apr 12, 2025
ba42913
Merge branch 'draft' into fix/story-test
kenyiu Apr 12, 2025
72c6e26
refactor: remove unnecessary comments and improve test readability in…
kenyiu Apr 12, 2025
2253e5e
feat: add PASSPORT_SCORER_ID to environment sample and config for dyn…
kenyiu Apr 12, 2025
2b5748f
test: add automated tests for TokenBalanceChart component
kenyiu Apr 12, 2025
3843c9a
test: update setupCanvas timeout and improve user interaction test in…
kenyiu Apr 12, 2025
323e0ed
test: enhance TokenBalanceTable story with expanded row interaction t…
kenyiu Apr 12, 2025
87787e9
feat: add locale support to TokenBalanceTable and TokenChipWithInfo c…
kenyiu Apr 14, 2025
afb4c6c
feat: add locale support to TokenPriceChart and TokenChipWithInfo com…
kenyiu Apr 14, 2025
5361660
feat: add locale support to TokenPriceChartWithFeed component
kenyiu Apr 14, 2025
178a079
feat: enhance TokenPriceChartWithFeed and YieldHistoricalChart with t…
kenyiu Apr 14, 2025
adf61bf
test: add testing capabilities to TransactionCard and TransactionCard…
kenyiu Apr 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@types/node": "^22.10.2",
"shadcn": "2.4.0",
"tsx": "4.19.2",
"vitest": "^2.1.9",
"vitest": "3.1.1",
"http-server": "14.1.1",
"@fleek-platform/cli": "^3.8.2"
},
Expand Down
6 changes: 6 additions & 0 deletions apps/registry/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ export const parseItem = async (
for (const node of sourceFile.getImportDeclarations()) {
const currentImport = node.getModuleSpecifier().getLiteralValue();

const isTypeOnly = node.isTypeOnly();

if (isTypeOnly) {
continue;
}

const {
packageName,
registryPath,
Expand Down
8 changes: 4 additions & 4 deletions apps/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build": "storybook build",
"preview": "vite preview",
"test": "vitest",
"test:storybook-runner": "test-storybook",
"test:storybook-runner": "test-storybook --testTimeout=60000",
"config:setup": "node --experimental-json-modules ./src/scripts/setup.mjs",
"deploy:fleek": "fleek --debug sites deploy"
},
Expand Down Expand Up @@ -70,7 +70,7 @@
"@ucanto/interface": "^10.0.1",
"@ucanto/transport": "^9.1.1",
"@wagmi/connectors": "^5.7.12",
"@wagmi/core": "^2.16.7",
"@wagmi/core": "^2.13.8",
"@web3-storage/w3up-client": "^16.5.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
Expand Down Expand Up @@ -129,7 +129,7 @@
"typescript-eslint": "^8.0.1",
"vite": "^5.4.1",
"vite-plugin-node-polyfills": "^0.22.0",
"vitest": "^2.1.9",
"wagmi": "^2.14.16"
"vitest": "3.1.1",
"wagmi": "^2.12.16"
}
}
24 changes: 24 additions & 0 deletions apps/storybook/src/stories/account/Balance.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import type { Meta, StoryObj } from "@storybook/react";
import { BY_USER } from "@geist/domain/user.fixture";
import { Balance } from "@geist/ui-react/components/account/balance";
import { BY_CHAIN_ID, Token } from "@geist/ui-react/lib/token/config";
import { expect } from "@storybook/test";
import type { Address } from "viem";
import { base, mainnet, optimism } from "viem/chains";
import { withWagmiProvider } from "../decorators/wagmi";
import { setupCanvas } from "../utils/test-utils";

const meta = {
title: "Account/Balance",
Expand All @@ -21,17 +23,33 @@ const meta = {
export default meta;
type Story = StoryObj<typeof meta>;

async function testBalanceDisplay(
canvasElement: HTMLElement,
tokenRegex: RegExp,
) {
const { canvas } = await setupCanvas(canvasElement, 4000);

const balanceText = await canvas.findByText(tokenRegex);
expect(balanceText).toBeInTheDocument();
}

export const MainnetETH: Story = {
args: {
address: BY_USER.vitalik.address as Address,
},
play: async ({ canvasElement }) => {
await testBalanceDisplay(canvasElement, /ETH/);
},
};

export const BaseETH: Story = {
args: {
address: BY_USER.vitalik.address as Address,
chainId: base.id,
},
play: async ({ canvasElement }) => {
await testBalanceDisplay(canvasElement, /ETH/);
},
};

export const MainnetUSDC: Story = {
Expand All @@ -40,6 +58,9 @@ export const MainnetUSDC: Story = {
tokenAddress: BY_CHAIN_ID[mainnet.id][Token.USDC] as Address,
chainId: mainnet.id,
},
play: async ({ canvasElement }) => {
await testBalanceDisplay(canvasElement, /USDC/);
},
};

export const OptimismUSDC: Story = {
Expand All @@ -48,4 +69,7 @@ export const OptimismUSDC: Story = {
tokenAddress: BY_CHAIN_ID[optimism.id][Token.USDC] as Address,
chainId: optimism.id,
},
play: async ({ canvasElement }) => {
await testBalanceDisplay(canvasElement, /USDC/);
},
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { UploadAttestation } from "@geist/ui-react/components/attestations/upload-attestation";
import { getShortAddress } from "@geist/ui-react/lib/utils/address";
import type { Meta, StoryObj } from "@storybook/react";
import { injected } from "@wagmi/connectors";
import { useAccount, useConnect, useDisconnect } from "wagmi";
import { injected } from "wagmi/connectors";
import { Button } from "#components/ui/button";
import { withToaster } from "../decorators/toaster";
import { withWagmiProvider } from "../decorators/wagmi";
Expand Down
33 changes: 33 additions & 0 deletions apps/storybook/src/stories/codec/CodecForm.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { CodecForm } from "@geist/ui-react/components/codec/CodecForm";
import type { Meta, StoryObj } from "@storybook/react";
import { expect, userEvent, within } from "@storybook/test";
import { setupCanvas } from "../utils/test-utils";

import { map } from "nanostores";

Expand All @@ -17,13 +19,35 @@ const meta = {
export default meta;
type Story = StoryObj<typeof meta>;

async function testCodecForm(canvasElement: any, expectedTexts: string[]) {
const { canvas } = await setupCanvas(canvasElement, 0);
const input = await canvas.getByRole("textbox");
await expect(input).toBeVisible();
await userEvent.type(input, "123abc");
await new Promise((resolve) => setTimeout(resolve, 1000));
await expect(canvas.getByText('{"message":"123abc"}')).toBeVisible();
await expect(canvas.getByText("codec: cid")).toBeVisible();
expectedTexts.forEach(async (text) => {
await expect(canvas.getByText(text)).toBeVisible();
});
}

export const Multibase64: Story = {
args: {
$codec: map({
input: "",
codec: "multibase64",
}),
},
play: async ({ canvasElement }) => {
await testCodecForm(canvasElement, [
"bagaaieramt5v6v252z63hzr2l7f37gwznp7s5ialbtvasyfno4iz3sbjkstq",
"codec: multibase64",
"mAYAEEiBk+19XXdZ9s+Y6X8u/mtlr/y6gCwzqCWCtdxGdyClUpw",
"codec: base64",
"AYAEEiCcptlVPp19Q9ncKA2+CSUrhHCKGAlJrVnYuV0NVfUE4w==",
]);
},
};

export const Multibase16: Story = {
Expand All @@ -33,6 +57,15 @@ export const Multibase16: Story = {
codec: "multibase16",
}),
},
play: async ({ canvasElement }) => {
await testCodecForm(canvasElement, [
"bagaaieramt5v6v252z63hzr2l7f37gwznp7s5ialbtvasyfno4iz3sbjkstq",
"codec: multibase16",
"f018004122064fb5f575dd67db3e63a5fcbbf9ad96bff2ea00b0cea0960ad77119dc82954a7",
"codec: base16",
"01800412209CA6D9553E9D7D43D9DC280DBE09252B84708A180949AD59D8B95D0D55F504E3",
]);
},
};

// TODO CID
Expand Down
10 changes: 5 additions & 5 deletions apps/storybook/src/stories/decorators/wagmi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { BY_USER, getRandomAccount } from "@geist/domain/user.fixture";
import { WAGMI_CONFIG_PARAMS } from "@geist/ui-react/lib/utils/wagmi-config";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { mock } from "@wagmi/connectors";
import type { MockParameters } from "@wagmi/connectors";

import type { Hex } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import {
type Config,
type CreateConfigParameters,
WagmiProvider,
createConfig,
Expand All @@ -26,10 +27,9 @@ const createMockConfig = (
...(wagmiConfigParams.connectors || []),
mock({
accounts: [account?.address],
features: {
defaultConnected: true,
},
}),
features: {},
defaultConnected: true,
} as MockParameters),
],
});
return {
Expand Down
22 changes: 22 additions & 0 deletions apps/storybook/src/stories/identity/AddressBadge.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { faker } from "@faker-js/faker";
import { AddressBadge } from "@geist/ui-react/components/identity/address-badge";
import type { Meta, StoryObj } from "@storybook/react";
import { expect } from "@storybook/test";
import type { Hex } from "viem";
import { setupCanvas } from "../utils/test-utils";

const meta = {
title: "Identity/AddressBadge",
Expand All @@ -19,11 +21,31 @@ export const Short: Story = {
args: {
address: faker.finance.ethereumAddress() as Hex,
},
play: async ({ canvasElement }) => {
const { canvas } = await setupCanvas(canvasElement);

const addressBadge = await canvas.findByText(
/^0x[a-fA-F0-9]{4}\.\.\.[a-fA-F0-9]{4}$/,
);
expect(addressBadge).toBeInTheDocument();

const tooltipTrigger = await canvas.findByTestId("tooltip-trigger");
expect(tooltipTrigger).toBeInTheDocument();
},
};

export const Full: Story = {
args: {
address: faker.finance.ethereumAddress() as Hex,
isFull: true,
},
play: async ({ canvasElement }) => {
const { canvas } = await setupCanvas(canvasElement);

const addressBadge = await canvas.findByText(/^0x[a-fA-F0-9]{40}$/);
expect(addressBadge).toBeInTheDocument();

const tooltipTrigger = await canvas.findByTestId("tooltip-trigger");
expect(tooltipTrigger).toBeInTheDocument();
},
};
20 changes: 16 additions & 4 deletions apps/storybook/src/stories/identity/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { BY_USER } from "@geist/domain/user.fixture";
import { Avatar } from "@geist/ui-react/components/identity/avatar";
import type { Meta, StoryObj } from "@storybook/react";
import {
withQueryClientProvider,
withWagmiProvider,
} from "../decorators/wagmi";
import { expect } from "@storybook/test";
import { withQueryClientProvider } from "../decorators/wagmi";
import { setupCanvas } from "../utils/test-utils";

const meta = {
title: "Identity/Avatar/Avatar",
Expand All @@ -15,16 +14,29 @@ const meta = {
export default meta;
type Story = StoryObj<typeof meta>;

const testAvatarRendering = async (canvasElement: HTMLElement) => {
const { canvas } = await setupCanvas(canvasElement, 6000);

const avatar = await canvas.findByRole("img");
expect(avatar).toBeInTheDocument();
};

export const Ens: Story = {
args: {
addressOrEns: BY_USER.vitalik.ens,
},
decorators: [withQueryClientProvider()],
play: async ({ canvasElement }) => {
await testAvatarRendering(canvasElement);
},
};

export const Address: Story = {
args: {
addressOrEns: BY_USER.vitalik.address,
},
decorators: [withQueryClientProvider()],
play: async ({ canvasElement }) => {
await testAvatarRendering(canvasElement);
},
};
14 changes: 14 additions & 0 deletions apps/storybook/src/stories/identity/AvatarWagmi.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react";

import { BY_USER } from "@geist/domain/user.fixture";
import { AvatarWagmi } from "@geist/ui-react/components/identity/avatar-wagmi";
import { expect, within } from "@storybook/test";
import { withWagmiProvider } from "../decorators/wagmi";

const meta = {
Expand All @@ -13,9 +14,22 @@ const meta = {
export default meta;
type Story = StoryObj<typeof meta>;

const testAvatarRendering = async (canvasElement: HTMLElement) => {
const canvas = within(canvasElement);

await new Promise((resolve) => setTimeout(resolve, 4000));

// Check if the avatar is displayed correctly
const avatar = await canvas.findByRole("img");
expect(avatar).toBeInTheDocument();
};

export const EnsWagmi: Story = {
args: {
ens: BY_USER.vitalik.ens,
},
decorators: [withWagmiProvider()],
play: async ({ canvasElement }) => {
await testAvatarRendering(canvasElement);
},
};
13 changes: 13 additions & 0 deletions apps/storybook/src/stories/identity/Name.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { BY_USER } from "@geist/domain/user.fixture";
import { Name } from "@geist/ui-react/components/identity/name";
import type { Meta, StoryObj } from "@storybook/react";
import { expect } from "@storybook/test";
import { withQueryClientProvider } from "../decorators/wagmi";
import { setupCanvas } from "../utils/test-utils";

const meta = {
title: "Identity/Name/Name",
Expand All @@ -15,9 +17,20 @@ const meta = {
export default meta;
type Story = StoryObj<typeof meta>;

// Helper function to test that the name is displayed correctly
const testNameRendering = async (canvasElement: HTMLElement) => {
const { canvas } = await setupCanvas(canvasElement);

const name = await canvas.findByTestId("name");
expect(name).toBeInTheDocument();
};

export const Short: Story = {
args: {
addressOrEns: BY_USER.vitalik.address,
},
decorators: [withQueryClientProvider()],
play: async ({ canvasElement }) => {
await testNameRendering(canvasElement);
},
};
13 changes: 13 additions & 0 deletions apps/storybook/src/stories/identity/NameWagmi.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@ const meta = {
} satisfies Meta<typeof NameWagmi>;

export default meta;
import { expect } from "@storybook/test";
import { setupCanvas } from "../utils/test-utils";

type Story = StoryObj<typeof meta>;

const testNameRendering = async (canvasElement: HTMLElement) => {
const { canvas } = await setupCanvas(canvasElement);

const name = await canvas.findByTestId("name");
expect(name).toBeInTheDocument();
};

export const Short: Story = {
args: {
addressOrEns: BY_USER.vitalik.address,
},
decorators: [withWagmiProvider()],
play: async ({ canvasElement }) => {
await testNameRendering(canvasElement);
},
};
Loading