35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
jest.mock('../crypto', () => ({
|
|
signData: jest.fn((data) => `signed:${data}`),
|
|
}));
|
|
|
|
describe('premium-module-manifest', () => {
|
|
beforeEach(() => {
|
|
jest.useFakeTimers();
|
|
jest.setSystemTime(new Date('2026-05-26T00:00:00.000Z'));
|
|
});
|
|
|
|
afterEach(() => {
|
|
jest.useRealTimers();
|
|
});
|
|
|
|
it('应为标准版生成自定义模板核心模块清单', async () => {
|
|
const { buildSignedPremiumModuleManifest } = await import('../premium-module-manifest');
|
|
const result = buildSignedPremiumModuleManifest('STANDARD', new Date('2026-06-25T00:00:00.000Z'));
|
|
|
|
expect(result.manifest.licenseType).toBe('STANDARD');
|
|
expect(result.manifest.modules.map((module) => module.id)).toEqual(['custom-templates-core']);
|
|
expect(result.signature).toContain('signed:');
|
|
});
|
|
|
|
it('应为专业版生成全部付费模块清单', async () => {
|
|
const { buildSignedPremiumModuleManifest } = await import('../premium-module-manifest');
|
|
const result = buildSignedPremiumModuleManifest('PRO', new Date('2026-07-25T00:00:00.000Z'));
|
|
|
|
expect(result.manifest.modules.map((module) => module.id)).toEqual([
|
|
'custom-templates-core',
|
|
'intranet-penetration-core',
|
|
]);
|
|
});
|
|
});
|
|
|