Add standard iPhone, iPad, and marketing AppIcon variants with asset regression coverage.
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
import { access, readFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const iconDirectory = join(process.cwd(), "ios/App/App/Assets.xcassets/AppIcon.appiconset");
|
|
|
|
describe("iOS app icon asset catalog", () => {
|
|
it("contains complete iPhone, iPad, and marketing icon variants", async () => {
|
|
const contents = JSON.parse(await readFile(join(iconDirectory, "Contents.json"), "utf8"));
|
|
const expected = [
|
|
["iphone", "20x20", "2x"],
|
|
["iphone", "20x20", "3x"],
|
|
["iphone", "29x29", "2x"],
|
|
["iphone", "29x29", "3x"],
|
|
["iphone", "40x40", "2x"],
|
|
["iphone", "40x40", "3x"],
|
|
["iphone", "60x60", "2x"],
|
|
["iphone", "60x60", "3x"],
|
|
["ipad", "20x20", "1x"],
|
|
["ipad", "20x20", "2x"],
|
|
["ipad", "29x29", "1x"],
|
|
["ipad", "29x29", "2x"],
|
|
["ipad", "40x40", "1x"],
|
|
["ipad", "40x40", "2x"],
|
|
["ipad", "76x76", "1x"],
|
|
["ipad", "76x76", "2x"],
|
|
["ipad", "83.5x83.5", "2x"],
|
|
["ios-marketing", "1024x1024", "1x"],
|
|
];
|
|
|
|
expect(contents.images).toHaveLength(expected.length);
|
|
for (const [idiom, size, scale] of expected) {
|
|
const image = contents.images.find(
|
|
(candidate) => candidate.idiom === idiom && candidate.size === size && candidate.scale === scale
|
|
);
|
|
expect(image, `${idiom} ${size} ${scale}`).toBeDefined();
|
|
await access(join(iconDirectory, image.filename));
|
|
}
|
|
});
|
|
});
|