Testing
Stellar Explorer uses Vitest with the happy-dom environment.
Running Tests
Section titled “Running Tests”bun run test # Run all tests oncebun run test:watch # Run in watch modeRun a single test file:
bunx vitest run src/lib/utils/format.test.tsTest File Location
Section titled “Test File Location”Test files live alongside their source files using the *.test.{ts,tsx} naming convention:
src/lib/utils/ format.ts format.test.tsWriting Tests
Section titled “Writing Tests”import { describe, it, expect } from "vitest";import { formatAmount } from "./format";
describe("formatAmount", () => { it("formats XLM amounts correctly", () => { expect(formatAmount("10000000")).toBe("1.0000000"); });});Environment
Section titled “Environment”Tests run in happy-dom, a lightweight browser environment. This allows testing React components without a full browser.