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.
crispy-train/test/unit/base/util/route-loader_test.js

25 lines
677 B
JavaScript
Raw Permalink Normal View History

2016-02-18 21:50:45 -05:00
'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);
});
});