25 lines
677 B
JavaScript
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);
|
||
|
});
|
||
|
});
|