mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 15:33:56 +08:00
test(harmony): reuse Stage HAP projection fixtures (#17307)
This commit is contained in:
@@ -180,13 +180,9 @@ describe("HarmonyOS application projection", () => {
|
||||
"retains the JavaScript runtime hint for an authenticated .%s component",
|
||||
async (extension) => {
|
||||
const member = `assets/js/index.${extension}`;
|
||||
const path = await writeApplicationZip(
|
||||
"rea-harmony-javascript-",
|
||||
"Fixture.hap",
|
||||
[{ path: member, content: "export const value = 1;" }],
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(path);
|
||||
const projection = projectHarmonyInventory(inventory);
|
||||
const projection = await projectStageHap("rea-harmony-javascript-", [
|
||||
{ path: member, content: "export const value = 1;" },
|
||||
]);
|
||||
expect(projection.components.javascript).toEqual([
|
||||
expect.objectContaining({ path: member, format: "javascript-bundle" }),
|
||||
]);
|
||||
@@ -196,16 +192,10 @@ describe("HarmonyOS application projection", () => {
|
||||
);
|
||||
|
||||
it("does not infer JavaScript from unrelated inventory content", async () => {
|
||||
const path = await writeApplicationZip(
|
||||
"rea-harmony-no-javascript-",
|
||||
"Fixture.hap",
|
||||
[
|
||||
{ path: "module.json", content: "{}" },
|
||||
{ path: "assets/js/notes.txt", content: "ordinary text" },
|
||||
],
|
||||
);
|
||||
const inventory = await inventoryApplicationPackage(path);
|
||||
const projection = projectHarmonyInventory(inventory);
|
||||
const projection = await projectStageHap("rea-harmony-no-javascript-", [
|
||||
{ path: "module.json", content: "{}" },
|
||||
{ path: "assets/js/notes.txt", content: "ordinary text" },
|
||||
]);
|
||||
expect(projection.components.javascript).toEqual([]);
|
||||
expect(projection.runtime_families).toEqual([]);
|
||||
});
|
||||
@@ -604,18 +594,11 @@ describe("HarmonyOS manifest path rules", () => {
|
||||
it("claims stage and FA models only from the exact manifest filenames", async () => {
|
||||
// HAP/HSP/App Pack members are ZIP names. OpenHarmony's stage, FA, and
|
||||
// app-pack manifests are module.json, config.json, and pack.info.
|
||||
const path = await writeApplicationZip(
|
||||
"rea-harmony-manifest-case-",
|
||||
"Fixture.hap",
|
||||
[
|
||||
{ path: "MODULE.JSON", content: "{}" },
|
||||
{ path: "CONFIG.JSON", content: "{}" },
|
||||
{ path: "PACK.INFO", content: "{}" },
|
||||
],
|
||||
);
|
||||
const projection = projectHarmonyInventory(
|
||||
await inventoryApplicationPackage(path),
|
||||
);
|
||||
const projection = await projectStageHap("rea-harmony-manifest-case-", [
|
||||
{ path: "MODULE.JSON", content: "{}" },
|
||||
{ path: "CONFIG.JSON", content: "{}" },
|
||||
{ path: "PACK.INFO", content: "{}" },
|
||||
]);
|
||||
expect(projection.packaging_model).toBe("unknown");
|
||||
expect(projection.components.manifests).toEqual([]);
|
||||
// Exact-case manifest names only, so these members belong to no manifest
|
||||
|
||||
Reference in New Issue
Block a user