Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/bundle-size-badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- uses: actions/setup-node@v7
with:
node-version: 20
node-version-file: '.nvmrc'
cache: 'npm'

- run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage-badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: '.nvmrc'
cache: npm

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- uses: actions/setup-node@v7
with:
node-version: 20
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:

- uses: actions/setup-node@v7
with:
node-version: 20
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/preview-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 20
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
Expand Down
2 changes: 2 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
npm run typecheck
11 changes: 11 additions & 0 deletions src/app/governance/archive/page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { describe, expect, it } from "vitest";
import { render, screen } from "@testing-library/react";
import GovernanceArchivePage from "./page";

describe("GovernanceArchivePage", () => {
it("renders proposals from the governance store", async () => {
render(await GovernanceArchivePage({ searchParams: {} }));
expect(screen.getByRole("heading", { name: "Governance Archive" })).toBeInTheDocument();
expect(screen.getAllByRole("listitem").length).toBeGreaterThan(0);
});
});
4 changes: 2 additions & 2 deletions src/app/governance/archive/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Metadata } from 'next';
import Link from 'next/link';
import { notFound } from 'next/navigation';
import { governanceStore } from '@/lib/governanceStore';
import { isValidStellarAddress } from '@/lib/stellarAddress';
import { isValidStellarPublicKey } from '@/lib/stellarAddress';
import { toCsv } from '@/lib/csv';

const STATUSES = ['all', 'passed', 'rejected', 'expired', 'executed'] as const;
Expand Down Expand Up @@ -228,7 +228,7 @@ export default async function GovernanceArchivePage({
}

export function VoterHistory({ address, votes }: { address: string; votes: Array<{ proposalId: string; choice: string; weight: string; timestamp: string }> }) {
if (!isValidStellarAddress(address)) notFound();
if (!isValidStellarPublicKey(address)) notFound();
const csv = toCsv(votes.map((v) => ({ proposalId: v.proposalId, choice: v.choice, weight: v.weight, timestamp: v.timestamp })));
return (
<section>
Expand Down
23 changes: 23 additions & 0 deletions src/app/governance/delegates/page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { describe, expect, it } from "vitest";
import { render, screen, fireEvent } from "@testing-library/react";
import DelegatesPage from "./page";

// Mounts the page with the real useDelegation hook so a hook signature change
// fails here instead of only at runtime.
describe("DelegatesPage", () => {
it("renders the directory from the hook and starts a delegation review", async () => {
render(<DelegatesPage />);
expect(screen.getByRole("heading", { name: "Voting delegation" })).toBeInTheDocument();
expect(await screen.findByText("Stellar Builders")).toBeInTheDocument();

fireEvent.click(screen.getAllByRole("button", { name: "Delegate" })[0]);
expect(screen.getByRole("button", { name: /Simulate, sign/ })).toBeInTheDocument();
});

it("rejects an invalid manual address", () => {
render(<DelegatesPage />);
fireEvent.change(screen.getByLabelText("Address"), { target: { value: "not-an-address" } });
fireEvent.click(screen.getByRole("button", { name: "Review delegation" }));
expect(screen.getByRole("alert")).toHaveTextContent("valid Stellar address");
});
});
Loading
Loading