import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname, join } from "node:path";

const __dirname = dirname(fileURLToPath(import.meta.url));
const source = readFileSync(join(__dirname, "ProductionLedgerView.vue"), "utf8");

describe("ProductionLedgerView archive actions", () => {
  it("uses DocumentArchiveActions for material out and inbound settlement archives", () => {
    assert.match(source, /DocumentArchiveActions/);
    assert.match(source, /production-material-out/);
    assert.match(source, /production-inbound-settlement/);
  });

  it("has preview, download and regenerate archive handlers", () => {
    assert.match(source, /previewDocumentArchive/);
    assert.match(source, /downloadDocumentArchive/);
    assert.match(source, /regenerateDocumentArchive/);
  });
});
