boats
Version:
Beautiful Open / Async Template System - Write less yaml with BOATS and Nunjucks.
43 lines (42 loc) • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const GetCheckCorrectBoatsRc_1 = tslib_1.__importDefault(require("../GetCheckCorrectBoatsRc"));
it('should warn about the invalid string style types', async () => {
// @ts-ignore
global.console = {
warn: jest.fn(),
};
GetCheckCorrectBoatsRc_1.default.parse({
nunjucksOptions: {
tags: {},
},
permissionConfig: {
// @ts-ignore
permissionStyle: 'snakeCase',
},
});
expect(global.console.warn).toHaveBeenCalled();
});
it('should warn and write old config naming to new', async () => {
// @ts-ignore
global.console = {
warn: jest.fn(),
};
const newRc = GetCheckCorrectBoatsRc_1.default.parse({
nunjucksOptions: {
tags: {},
},
permissionConfig: {
usePackageJsonNameAsPrefix: true,
routePrefix: {},
},
fancyPluralization: true
});
expect(global.console.warn).toHaveBeenCalled();
expect(newRc.permissionConfig.usePackageJsonNameAsPrefix).toBe(undefined);
expect(newRc.permissionConfig.globalPrefix).toBe(true);
expect(newRc.permissionConfig.routePrefix).toBe(undefined);
expect(newRc.permissionConfig.methodAlias).toEqual({});
expect(newRc.fancyPluralization).toEqual(true);
});