@cainiaofe/cn-utils
Version:
菜鸟前端基础工具库
54 lines (53 loc) • 3.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("../index");
test('verbose', function () {
expect((0, index_1.getCnEnv)({ hostname: 'http://127.0.0.1:7210/#/xxx' })).toBe(index_1.DAILY);
expect((0, index_1.getCnEnv)({ hostname: '127.0.0.1:7210/#/xxx' })).toBe(index_1.DAILY);
expect((0, index_1.getCnEnv)({ hostname: '127.0.0.1:7210' })).toBe(index_1.DAILY);
});
test('daily', function () {
expect((0, index_1.getCnEnv)({ hostname: '127.0.0.1' })).toBe(index_1.DAILY);
expect((0, index_1.getCnEnv)({ hostname: 'localhost' })).toBe(index_1.DAILY);
expect((0, index_1.getCnEnv)({ hostname: '30.117.72.7' })).toBe(index_1.DAILY);
});
test('国际-gpn', function () {
expect((0, index_1.getCnEnv)({ hostname: 'os.gpn.cainiao-inc.com' })).toBe(index_1.PROD);
expect((0, index_1.getCnEnv)({ hostname: 'pre-os.gpn.cainiao-inc.com' })).toBe(index_1.PRE);
expect((0, index_1.getCnEnv)({ hostname: 'daily.os.gpn.cainiao-inc.test' })).toBe(index_1.DAILY);
});
test('pk', function () {
expect((0, index_1.getCnEnv)({ hostname: 'pre2-pk.cainiao.com' })).toBe(index_1.PRE);
});
test('ct', function () {
expect((0, index_1.getCnEnv)({ hostname: 'daily-ct.cainiao.test' })).toBe(index_1.DAILY);
});
test('企业智能-hr', function () {
expect((0, index_1.getCnEnv)({ hostname: 'hr.cainiao.com' })).toBe(index_1.PROD);
expect((0, index_1.getCnEnv)({ hostname: 'pre-hr.cainiao.com' })).toBe(index_1.PRE);
expect((0, index_1.getCnEnv)({ hostname: 'hr.cainiao.test' })).toBe(index_1.TEST);
});
test('国内-cwoutprod', function () {
expect((0, index_1.getCnEnv)({ hostname: 'cwoutprod.cainiao.com' })).toBe(index_1.PROD);
expect((0, index_1.getCnEnv)({ hostname: 'pre-cwoutprod.cainiao.com' })).toBe(index_1.PRE);
});
test('国内-inbound', function () {
expect((0, index_1.getCnEnv)({ hostname: 'cw-inbound.cainiao.com' })).toBe(index_1.PROD);
expect((0, index_1.getCnEnv)({ hostname: 'pre.cw-inbound.cainiao.com' })).toBe(index_1.PRE);
});
test('地网-park', function () {
expect((0, index_1.getCnEnv)({ hostname: 'park.cainiao.com' })).toBe(index_1.PROD);
expect((0, index_1.getCnEnv)({ hostname: 'pre-park.cainiao.com' })).toBe(index_1.PRE);
expect((0, index_1.getCnEnv)({ hostname: 'park.cainiao.test' })).toBe(index_1.TEST);
});
test('iot', function () {
expect((0, index_1.getCnEnv)({ hostname: 'iot.cainiao.com' })).toBe(index_1.PROD);
expect((0, index_1.getCnEnv)({ hostname: 'pre-iot.cainiao.com' })).toBe(index_1.PRE);
expect((0, index_1.getCnEnv)({ hostname: 'iot.cainiao.test' })).toBe(index_1.TEST);
});
test('src', function () {
var prodSrc = 'https://g.alicdn.com/cnxt/web-app-sample/0.1.25/js/app.js';
var devSrc = 'https://dev.g.alicdn.com/cnxt/web-app-sample/0.1.25/js/app.js';
expect((0, index_1.getCnEnv)({ hostname: 'xxx', currentScriptSrc: prodSrc })).toBe(index_1.PROD);
expect((0, index_1.getCnEnv)({ hostname: 'xxx', currentScriptSrc: devSrc })).toBe(index_1.DAILY);
});