mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
test(artifacts): reuse Apple application inventory fixtures (#16569)
This commit is contained in:
1 parent
297c5e6eab
commit
8e7fa410de
1 file changed
+9
-45
@@ -1,5 +1,4 @@
|
||||
import { fileIdentity } from "../../fixtures/evidenceSubject.js";
|
||||
import { projectCliAnalysisResult } from "../../../src/cli/projectCliAnalysisResult.js";
|
||||
import { mkdir, symlink, writeFile } from "node:fs/promises";
|
||||
import { dirname, join } from "node:path";
|
||||
|
||||
@@ -17,16 +16,13 @@ import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
import { minimalMachoImage } from "../../fixtures/nativeHeaders.js";
|
||||
import {
|
||||
createNonApplicationZipInventory,
|
||||
inventoryApplicationPackage,
|
||||
requireSuccessfulProjection,
|
||||
} from "../../support/applicationSessionFixture.js";
|
||||
|
||||
import { projectAppleApplicationEvidence } from "../../../src/application/InventoryProjectionEvidence.js";
|
||||
import { createDirectAnalysis } from "../../../src/composition/directAnalysis.js";
|
||||
import { thinMach } from "../../../src/domain/binaryTarget.fixture.js";
|
||||
import { appleApplicationProjectionResultSchema } from "../../../src/domain/apple/appleApplication.js";
|
||||
import { parseEvidence } from "../../../src/domain/evidence.js";
|
||||
|
||||
const { runProviderAnalysis } = createDirectAnalysis({});
|
||||
|
||||
// Real ZIP entries cross the former component and bridge-candidate limits.
|
||||
const FRAMEWORK_COUNT = 250;
|
||||
@@ -58,11 +54,7 @@ async function createCompleteAppleProjection() {
|
||||
}
|
||||
await writeFile(path, await writer.close());
|
||||
|
||||
const inventory = parseEvidence(
|
||||
await runProviderAnalysis(path, "inventory_artifact", {}).then(
|
||||
projectCliAnalysisResult,
|
||||
),
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(path);
|
||||
const fragments = fragmentInventoryEvidence(inventory, 3);
|
||||
const result = projectAppleApplicationEvidence({
|
||||
inventory_evidence: fragments,
|
||||
@@ -96,11 +88,7 @@ describe("Apple application projection", () => {
|
||||
);
|
||||
await writeFile(path, await writer.close());
|
||||
|
||||
const inventory = parseEvidence(
|
||||
await runProviderAnalysis(path, "inventory_artifact", {}).then(
|
||||
projectCliAnalysisResult,
|
||||
),
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(path);
|
||||
expect(inventory.normalized_result).toMatchObject({
|
||||
coverage: { scope: "container-entries", status: "complete" },
|
||||
});
|
||||
@@ -147,11 +135,7 @@ describe("Apple application projection", () => {
|
||||
);
|
||||
await writeFile(path, await writer.close());
|
||||
|
||||
const inventory = parseEvidence(
|
||||
await runProviderAnalysis(path, "inventory_artifact", {}).then(
|
||||
projectCliAnalysisResult,
|
||||
),
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(path);
|
||||
const first = projectAppleApplicationEvidence({
|
||||
inventory_evidence: [inventory],
|
||||
});
|
||||
@@ -218,11 +202,7 @@ describe("Apple application projection", () => {
|
||||
const writer = new ZipWriter(new Uint8ArrayWriter());
|
||||
await writer.add("AndroidManifest.xml", new TextReader("<manifest/>"));
|
||||
await writeFile(path, await writer.close());
|
||||
const inventory = parseEvidence(
|
||||
await runProviderAnalysis(path, "inventory_artifact", {}).then(
|
||||
projectCliAnalysisResult,
|
||||
),
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(path);
|
||||
expect(
|
||||
projectAppleApplicationEvidence({ inventory_evidence: [inventory] }),
|
||||
).toMatchObject({
|
||||
@@ -254,11 +234,7 @@ async function projectArchive(
|
||||
options,
|
||||
);
|
||||
await writeFile(path, await writer.close());
|
||||
const inventory = parseEvidence(
|
||||
await runProviderAnalysis(path, "inventory_artifact", {}).then(
|
||||
projectCliAnalysisResult,
|
||||
),
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(path);
|
||||
return appleApplicationProjectionResultSchema.parse(
|
||||
requireSuccessfulProjection(
|
||||
projectAppleApplicationEvidence({ inventory_evidence: [inventory] }),
|
||||
@@ -358,11 +334,7 @@ describe("macOS application projection", () => {
|
||||
);
|
||||
await writeFile(path, await writer.close());
|
||||
|
||||
const inventory = parseEvidence(
|
||||
await runProviderAnalysis(path, "inventory_artifact", {}).then(
|
||||
projectCliAnalysisResult,
|
||||
),
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(path);
|
||||
const projection = appleApplicationProjectionResultSchema.parse(
|
||||
requireSuccessfulProjection(
|
||||
projectAppleApplicationEvidence({ inventory_evidence: [inventory] }),
|
||||
@@ -411,11 +383,7 @@ describe("macOS application projection", () => {
|
||||
join(app, "Contents/Frameworks/Core.framework/Versions/Current"),
|
||||
);
|
||||
|
||||
const inventory = parseEvidence(
|
||||
await runProviderAnalysis(app, "inventory_artifact", {}).then(
|
||||
projectCliAnalysisResult,
|
||||
),
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(app);
|
||||
const result = projectAppleApplicationEvidence({
|
||||
inventory_evidence: [inventory],
|
||||
});
|
||||
@@ -491,11 +459,7 @@ describe("Apple application projection completeness", () => {
|
||||
);
|
||||
await writeFile(path, await writer.close());
|
||||
|
||||
const inventory = parseEvidence(
|
||||
await runProviderAnalysis(path, "inventory_artifact", {}).then(
|
||||
projectCliAnalysisResult,
|
||||
),
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(path);
|
||||
const result = projectAppleApplicationEvidence({
|
||||
inventory_evidence: [inventory],
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user