|
@@ -142,5 +142,14 @@ describe('test/app/extend/helper.test.js', () => {
|
|
|
const id = ['abc', 'efj'];
|
|
|
const str = 'And id in (' + ctx.helper.getInArrStrSqlFilter(id) + ')';
|
|
|
assert(str === "And id in ('abc','efj')");
|
|
|
- })
|
|
|
+ });
|
|
|
+
|
|
|
+ it('test getChapterCode', function () {
|
|
|
+ const ctx = app.mockContext();
|
|
|
+ const testData = ['A101-1-a', 'A201B102-1', '新增203-1', '新增1001-1'];
|
|
|
+ const targetData = ['100', '100', '200', '1000'];
|
|
|
+ for (const i in testData) {
|
|
|
+ assert(ctx.helper.getChapterCode(testData[i]) === targetData[i]);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|