fix: resolve triaged correctness issues
This commit is contained in:
@@ -14,6 +14,8 @@ import {
|
||||
ProviderAdapterError,
|
||||
} from "../src/domain/errors.js";
|
||||
import { err } from "../src/domain/result.js";
|
||||
import { createEvidenceBundle } from "../src/domain/evidenceBundle.js";
|
||||
import { createInvestigationWorkspace } from "../src/domain/investigationWorkspace.js";
|
||||
import { observed as ok } from "./fixtures/analysisExecution.js";
|
||||
|
||||
let directory: string | undefined;
|
||||
@@ -24,6 +26,35 @@ afterEach(async () => {
|
||||
});
|
||||
|
||||
describe("binary session", () => {
|
||||
it("returns detached provider, target, and workspace metadata", async () => {
|
||||
const [first] = await targets();
|
||||
const session = new BinarySession(cacheProvider([]));
|
||||
expect((await session.open(first)).ok).toBe(true);
|
||||
const identity = session.providerIdentity();
|
||||
Reflect.set(identity, "id", "forged");
|
||||
expect(session.providerIdentity().id).toBe("fixture");
|
||||
|
||||
const active = session.activeTarget();
|
||||
expect(active).toBeDefined();
|
||||
if (active !== undefined) Reflect.set(active, "path", "/tmp/forged");
|
||||
expect(session.activeTarget()?.path).toBe(first);
|
||||
|
||||
const workspace = createInvestigationWorkspace(
|
||||
"Detached workspace",
|
||||
createEvidenceBundle([]),
|
||||
[],
|
||||
);
|
||||
expect(session.retainInvestigationWorkspace(workspace)).toBe("added");
|
||||
const direct = session.investigationWorkspace(workspace.workspace_id, 1);
|
||||
if (direct !== undefined) Reflect.set(direct, "revision", 999);
|
||||
const listed = session.investigationWorkspaces()[0];
|
||||
if (listed !== undefined) Reflect.set(listed, "workspace_id", "forged");
|
||||
expect(
|
||||
session.investigationWorkspace(workspace.workspace_id, 1),
|
||||
).toMatchObject({ revision: 1, workspace_id: workspace.workspace_id });
|
||||
await session.close();
|
||||
});
|
||||
|
||||
it("runs through a non-Hopper analysis provider", async () => {
|
||||
const [first] = await targets();
|
||||
const operations: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user