miter
Version:
A typescript web framework based on ExpressJs based loosely on SailsJs
25 lines • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const sinonChai = require("sinon-chai");
chai_1.use(sinonChai);
const join_route_paths_1 = require("../join-route-paths");
describe('util/joinRoutePaths', () => {
it('should return the root if no path segments are specified', () => {
chai_1.expect(join_route_paths_1.joinRoutePaths()).to.eql('/');
});
it('should join all path segments with a single forward slash', () => {
chai_1.expect(join_route_paths_1.joinRoutePaths('one', 'two', 'three')).to.eql('/one/two/three');
});
it('should strip duplicate forward slashes from path segments', () => {
chai_1.expect(join_route_paths_1.joinRoutePaths('/one/', '/two/', '/three')).to.eql('/one/two/three');
});
it('should ignore empty path segments', () => {
chai_1.expect(join_route_paths_1.joinRoutePaths('one', '', 'three')).to.eql('/one/three');
chai_1.expect(join_route_paths_1.joinRoutePaths('', '', '')).to.eql('/');
});
it('should allow a single forward slash at the end of the path', () => {
chai_1.expect(join_route_paths_1.joinRoutePaths('one', 'two', 'three/')).to.eql('/one/two/three/');
});
});
//# sourceMappingURL=join-route-paths.spec.js.map