This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
ProgBlog/test/unit/base/util/route-loader_test.js
2016-02-19 12:58:16 -05:00

25 lines
677 B
JavaScript

'use strict';
const path = require('path');
const testBase = require('../../../test-base');
const expect = testBase.expect;
let routeLoader = testBase.require('app/base/util/route-loader');
function getPath(filePath) {
return path.join(__dirname, filePath)
.replace(/\\/g, '/');
}
suite('Util - Route Loader', () => {
test('routeLoader creates accurate route mapping', () => {
let actual = routeLoader(path.join(__dirname, 'test-routes'));
let expected = {
'/api/foo/bar': getPath('test-routes/api/foo/bar.js'),
'/api/foo': getPath('test-routes/api/foo.js'),
'/': getPath('test-routes/index.js'),
};
expect(expected).to.be.deep.equal(actual);
});
});