mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
7f889a1a78
* support ConstantManager update * add unit test for ConstantManager handle Escape in unit test * fix `gulp build-h5-source` * publish * update deps update lock * update unit test * merge ConstantManager into StatsQuery && merge cc.config.json update * make dynamic ccGlobal optional * publish 4.3.2 and update deps * export StatsQuery * export some interface * update deps
64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import { ConstantManager } from '../../src/constant-manager';
|
|
|
|
const cm = new ConstantManager(__dirname);
|
|
|
|
test('generateInternalConstants', () => {
|
|
expect(cm.genInternalConstants()).toMatchSnapshot();
|
|
});
|
|
|
|
test('generateCCEnv', () => {
|
|
expect(cm.genCCEnv()).toMatchSnapshot();
|
|
});
|
|
|
|
test('exportStaticConstants', () => {
|
|
expect(cm.exportStaticConstants({
|
|
mode: 'PREVIEW',
|
|
platform: 'WECHAT',
|
|
flags: { DEBUG: false, SERVER_MODE: true },
|
|
})).toMatchSnapshot();
|
|
});
|
|
|
|
test('exportDynamicConstants', () => {
|
|
expect(cm.exportDynamicConstants({
|
|
mode: 'BUILD',
|
|
platform: 'WECHAT',
|
|
flags: { DEBUG: true, },
|
|
})).toMatchSnapshot();
|
|
});
|
|
|
|
test('genBuildTimeConstants', () => {
|
|
const result = cm.genBuildTimeConstants({
|
|
mode: 'TEST',
|
|
platform: 'NATIVE',
|
|
flags: { DEBUG: false, SERVER_MODE: true },
|
|
});
|
|
expect(result).toMatchInlineSnapshot(`
|
|
Object {
|
|
"ALIPAY": false,
|
|
"BAIDU": false,
|
|
"BUILD": false,
|
|
"BYTEDANCE": false,
|
|
"COCOSPLAY": false,
|
|
"DEBUG": false,
|
|
"DEV": true,
|
|
"EDITOR": false,
|
|
"HTML5": false,
|
|
"HUAWEI": false,
|
|
"JSB": true,
|
|
"LINKSURE": false,
|
|
"MINIGAME": false,
|
|
"NATIVE": true,
|
|
"OPPO": false,
|
|
"PREVIEW": false,
|
|
"QTT": false,
|
|
"RUNTIME_BASED": false,
|
|
"SERVER_MODE": true,
|
|
"SUPPORT_JIT": true,
|
|
"TEST": true,
|
|
"VIVO": false,
|
|
"WECHAT": false,
|
|
"XIAOMI": false,
|
|
}
|
|
`);
|
|
});
|