为 miniprogram-ci 和 Jimp 依赖增加兼容 patch 与 smoke test;修复平台模板管理员路由漏配;收紧模板契约校验;为 admin/customer 增加 token 撤销和集中会话存储;同步品牌切换角色、doctor source hash、多屏宽截图证据和 CI 构建门禁。
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { createRequire } from "node:module";
|
|
import test from "node:test";
|
|
|
|
const require = createRequire(import.meta.url);
|
|
const png = Buffer.from(
|
|
"89504e470d0a1a0a0000000d4948445200000001000000010802000000907753de0000000c49444154789c63f8cfc0000003010100c9fe92ef0000000049454e44ae426082",
|
|
"hex",
|
|
);
|
|
|
|
test("miniprogram-ci compatibility patches keep overridden runtime APIs usable", async () => {
|
|
const buildCloud = require(
|
|
require.resolve("miniprogram-ci/dist/modules/nativecompiler/ios/buildCloud.js"),
|
|
);
|
|
assert.equal(typeof buildCloud.default, "object");
|
|
|
|
const uuid = require("uuid") as { v4: () => string };
|
|
assert.match(uuid.v4(), /^[0-9a-f-]{36}$/);
|
|
|
|
const imageSize = require("image-size") as {
|
|
imageSize: (input: Buffer) => { width: number; height: number; type: string };
|
|
};
|
|
assert.deepEqual(imageSize.imageSize(png), { width: 1, height: 1, type: "png" });
|
|
|
|
const Jimp = require("jimp") as {
|
|
read: (input: Buffer) => Promise<{ bitmap: { width: number; height: number } }>;
|
|
};
|
|
const image = await Jimp.read(png);
|
|
assert.equal(image.bitmap.width, 1);
|
|
assert.equal(image.bitmap.height, 1);
|
|
});
|