boats
Version:
Beautiful Open / Async Template System - Write less yaml with BOATS and Nunjucks.
52 lines (51 loc) • 2.34 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const AutoIndexer_1 = tslib_1.__importDefault(require("../AutoIndexer"));
const boatsRcDummyObject = {
picomatchOptions: {},
nunjucksOptions: {},
permissionConfig: {}
};
describe('createChannelString', () => {
it('should return without the ext but with the / as a sep', async () => {
const output = AutoIndexer_1.default.createChannelString(boatsRcDummyObject, '/domains/RoleNameDomain.yml');
expect(output).toEqual('/domains/RoleNameDomain');
});
it('should return without the ext but with the . as a sep', async () => {
const output = AutoIndexer_1.default.createChannelString(boatsRcDummyObject, '/domains/RoleNameDomain.yml', {
channelSeparators: [{
match: '/domains/**',
separator: '.'
}]
});
expect(output).toEqual('domains.RoleNameDomain');
});
it('should return without the ext but with the . as a sep but with a deeper path', async () => {
const output = AutoIndexer_1.default.createChannelString(boatsRcDummyObject, '/domains/RoleNameDomain/Bob/Thing.yml', {
channelSeparators: [{
match: '/domains/**',
separator: '.'
}]
});
expect(output).toEqual('domains.RoleNameDomain.Bob.Thing');
});
it('should return without the ext but with the / as a sep even though there is a pico match', async () => {
const output = AutoIndexer_1.default.createChannelString(boatsRcDummyObject, '/domain/RoleNameDomain/Bob/Thing.yml', {
channelSeparators: [{
match: '/domains/**',
separator: '.'
}]
});
expect(output).toEqual('/domain/RoleNameDomain/Bob/Thing');
});
it('should return without the ext but with the . as a sep on a complete wildcard', async () => {
const output = AutoIndexer_1.default.createChannelString(boatsRcDummyObject, '/domain/RoleNameDomain/Bob/Thing.yml', {
channelSeparators: [{
match: '**',
separator: '.'
}]
});
expect(output).toEqual('domain.RoleNameDomain.Bob.Thing');
});
});