55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const templateDir = path.resolve(
|
|
path.dirname(fileURLToPath(import.meta.url)),
|
|
"../templates",
|
|
);
|
|
|
|
const checksumTemplate = readFileSync(
|
|
path.join(templateDir, "template_checksum_workflow.mjs"),
|
|
"utf8",
|
|
);
|
|
const inventoryTemplate = readFileSync(
|
|
path.join(templateDir, "template_inventory_workflow.mjs"),
|
|
"utf8",
|
|
);
|
|
|
|
const expectedSnippets = [
|
|
"template_checksum_workflow",
|
|
"Checksum validation workflow",
|
|
"template_inventory_workflow",
|
|
"Inventory reconciliation workflow",
|
|
];
|
|
|
|
test("checksum workflow template contains expected metadata", () => {
|
|
for (const snippet of [
|
|
"template_checksum_workflow",
|
|
"Checksum validation workflow",
|
|
]) {
|
|
assert.ok(checksumTemplate.includes(snippet));
|
|
}
|
|
});
|
|
|
|
test("inventory workflow template contains expected metadata", () => {
|
|
for (const snippet of [
|
|
"template_inventory_workflow",
|
|
"Inventory reconciliation workflow",
|
|
]) {
|
|
assert.ok(inventoryTemplate.includes(snippet));
|
|
}
|
|
});
|
|
|
|
test("workflow templates are documented in the SDK structure", () => {
|
|
const readme = readFileSync(
|
|
path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../README.md"),
|
|
"utf8",
|
|
);
|
|
for (const snippet of expectedSnippets) {
|
|
assert.ok(readme.includes(snippet) || readme.includes("templates/"));
|
|
}
|
|
});
|