Something went wrong. Try again.
fork of prime agent with changes i want but are not upstreamable probqbly (and some fixes)
Something went wrong. Try again.
1.4 kB · 45 lines
TypeScript
12345678910111213141516171819202122232425262728293031323334353637383940414243444546import { visibleWidth } from "@earendil-works/pi-tui";import { beforeAll, describe, expect, it } from "vitest";import type { ReadonlyFooterDataProvider } from "../src/core/footer-data-provider.js";import { FooterComponent } from "../src/modes/interactive/components/footer.js";import { initTheme } from "../src/modes/interactive/theme/theme.js";
function createFooterData(providerCount: number): ReadonlyFooterDataProvider { const provider = { getGitBranch: () => "main", getExtensionStatuses: () => new Map<string, string>(), getAvailableProviderCount: () => providerCount, onBranchChange: (callback: () => void) => { void callback; return () => {}; }, };
return provider;}
describe("FooterComponent width handling", () => { beforeAll(() => { initTheme(undefined, false); });
it("keeps all lines within width for narrow provider data", () => { const width = 93; const footer = new FooterComponent(createFooterData(1));
const lines = footer.render(width); for (const line of lines) { expect(visibleWidth(line)).toBeLessThanOrEqual(width); } });
it("keeps all lines within width for wide provider data", () => { const width = 60; const footer = new FooterComponent(createFooterData(2));
const lines = footer.render(width); for (const line of lines) { expect(visibleWidth(line)).toBeLessThanOrEqual(width); } });});