36 lines
951 B
TypeScript
36 lines
951 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { createArtifactsModule } from "../src/modules/artifacts/artifacts.module.ts";
|
|
|
|
test("retrieve artifacts by producer", () => {
|
|
const module = createArtifactsModule();
|
|
|
|
module.controller.createArtifact({
|
|
id: "artifact-1",
|
|
type: "json",
|
|
title: "Probe Report",
|
|
producerType: "run_task",
|
|
producerId: "task-1",
|
|
payload: {
|
|
detectedFormats: ["delivery_package"],
|
|
},
|
|
});
|
|
module.controller.createArtifact({
|
|
id: "artifact-2",
|
|
type: "directory",
|
|
title: "Normalized Folder",
|
|
producerType: "run_task",
|
|
producerId: "task-1",
|
|
payload: {
|
|
entries: ["DJI_001", "meta.json"],
|
|
},
|
|
});
|
|
|
|
const artifacts = module.controller.listArtifactsByProducer("run_task", "task-1");
|
|
|
|
assert.equal(artifacts.length, 2);
|
|
assert.equal(artifacts[0]?.title, "Probe Report");
|
|
assert.equal(artifacts[1]?.type, "directory");
|
|
});
|