123456789101112131415161718192021222324252627282930 |
- 'use strict';
- /**
- * 辅助方法扩展 单元测试
- *
- * @author Mai
- * @data 2018/4/20
- * @version
- */
- const { app, assert } = require('egg-mock/bootstrap');
- describe('test/app/extend/helper.test.js', () => {
- it('ValidTemplateCode test', function () {
- const ctx = app.mockContext();
- assert(ctx.helper.ValidTemplateCode('z') === true);
- assert(ctx.helper.ValidTemplateCode('Z') === true);
- assert(ctx.helper.ValidTemplateCode('-') === false);
- assert(ctx.helper.ValidTemplateCode('1') === false);
- assert(ctx.helper.ValidTemplateCode('z1') === true);
- assert(ctx.helper.ValidTemplateCode('z1-') === false);
- assert(ctx.helper.ValidTemplateCode('zav') === true);
- assert(ctx.helper.ValidTemplateCode('z1-e') === true);
- assert(ctx.helper.ValidTemplateCode('z1-e-1') === true);
- });
- it('ValidTemplateIndexCode test', function () {
- const ctx = app.mockContext();
- assert(ctx.helper.ValidTemplateIndexCode('z2-d-d-1~z2-d-d-5 高填方路段处理 同z2-d-c-1~z2-d-c-5') === false);
- });
- });
|