test(artifacts): assert exact refusal reasons, limits and cleanup reports (#15379)

* test(artifacts): assert exact refusal reasons, limits and cleanup reports

Replace ok:false-only, bare toThrow, class-only, expect.any and negative-only checks in parser and artifact tests with the exact failure kind, reason, limit, cleanup report, classification and retained samples the producers report.

* test(uefi): assert the receipt issue path through the retained cause
This commit is contained in:
morluto authored and GitHub committed 2026-12-01 02:09:05 +00:00
1 parent aa09b21a6e
commit db9a030020
16 files changed
+244 -63

No files matched your search

@@ -273,6 +273,8 @@ it.each([
cleanup,
cause: expect.any(ArtifactReaderFailure),
});
// Without cleanup, the changed evidence wraps the exact read failure.
else expect((failure as ArtifactReaderFailure).cause).toBe(primary);
expect(failure).toMatchObject({ partialObservation, details });
const projectedFailure = classifyProviderFailure(
failure,
@@ -284,7 +286,22 @@ it.each([
cleanupIncomplete: true,
cleanupResources: cleanup.resources,
});
} else {
expect(projectedFailure).toMatchObject({
_tag: "AnalysisArtifactChangedError",
cleanupIncomplete: false,
cleanupResources: [],
});
}
expect(projectAnalysisError(projectedFailure)).toMatchObject({
code: retainCleanup ? "cleanup_incomplete" : "artifact_changed",
category: "integrity_mismatch",
details: {
operation: "inspect_sqlite_database",
path: databasePath,
integrity_check: "container-identity",
},
});
} finally {
await resourceScope.close();
}