Remove dead code in app and XBRL loader
This commit is contained in:
@@ -9,11 +9,15 @@ import type {
|
||||
IssuerOverlayDiagnostics,
|
||||
IssuerOverlayStats,
|
||||
} from "@/lib/server/db/schema";
|
||||
import {
|
||||
ensureIssuerOverlayRow,
|
||||
getIssuerOverlay,
|
||||
listIssuerOverlayRevisions,
|
||||
publishIssuerOverlayRevision,
|
||||
} from "./issuer-overlays";
|
||||
|
||||
let tempDir: string | null = null;
|
||||
let sqliteClient: Database | null = null;
|
||||
let overlayRepo: typeof import("./issuer-overlays") | null = null;
|
||||
|
||||
function resetDbSingletons() {
|
||||
const globalState = globalThis as typeof globalThis & {
|
||||
__fiscalSqliteClient?: Database;
|
||||
@@ -90,8 +94,6 @@ describe("issuer overlay repo", () => {
|
||||
};
|
||||
globalState.__fiscalSqliteClient = sqliteClient;
|
||||
globalState.__fiscalDrizzleDb = undefined;
|
||||
|
||||
overlayRepo = await import("./issuer-overlays");
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
@@ -108,35 +110,27 @@ describe("issuer overlay repo", () => {
|
||||
});
|
||||
|
||||
it("creates an empty overlay row on ensure", async () => {
|
||||
if (!overlayRepo) {
|
||||
throw new Error("overlay repo not initialized");
|
||||
}
|
||||
|
||||
const overlay = await overlayRepo.ensureIssuerOverlayRow("aapl");
|
||||
const overlay = await ensureIssuerOverlayRow("aapl");
|
||||
expect(overlay?.ticker).toBe("AAPL");
|
||||
expect(overlay?.status).toBe("empty");
|
||||
expect(overlay?.active_revision).toBeNull();
|
||||
});
|
||||
|
||||
it("publishes and deduplicates overlay revisions by content hash", async () => {
|
||||
if (!overlayRepo) {
|
||||
throw new Error("overlay repo not initialized");
|
||||
}
|
||||
|
||||
const first = await overlayRepo.publishIssuerOverlayRevision({
|
||||
const first = await publishIssuerOverlayRevision({
|
||||
ticker: "AAPL",
|
||||
definition: sampleDefinition(),
|
||||
diagnostics: sampleDiagnostics(),
|
||||
stats: sampleStats(),
|
||||
});
|
||||
const second = await overlayRepo.publishIssuerOverlayRevision({
|
||||
const second = await publishIssuerOverlayRevision({
|
||||
ticker: "AAPL",
|
||||
definition: sampleDefinition(),
|
||||
diagnostics: sampleDiagnostics(),
|
||||
stats: sampleStats(),
|
||||
});
|
||||
const overlay = await overlayRepo.getIssuerOverlay("AAPL");
|
||||
const revisions = await overlayRepo.listIssuerOverlayRevisions("AAPL");
|
||||
const overlay = await getIssuerOverlay("AAPL");
|
||||
const revisions = await listIssuerOverlayRevisions("AAPL");
|
||||
|
||||
expect(first.published).toBe(true);
|
||||
expect(second.published).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user