-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathfallback.js
29 lines (25 loc) · 1.01 KB
/
fallback.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';
const chai = require('chai');
const expect = chai.expect;
const path = require('path');
const resolve = require('../index').resolve;
const file = path.join(__dirname, 'files', 'src', 'dummy.js');
describe('fallback', function () {
it('works', function () {
expect(resolve('fb-module', file)).property('path')
.to.equal(path.join(__dirname, 'files', 'fallback', 'fb-module.js'));
});
it('really works', function () {
expect(resolve('jsx/some-fb-file', file)).property('path')
.to.equal(path.join(__dirname, 'files', 'fallback', 'jsx', 'some-fb-file.js'));
});
it('prefer root', function () {
expect(resolve('jsx/some-file', file)).property('path')
.to.equal(path.join(__dirname, 'files', 'src', 'jsx', 'some-file.js'));
});
it('supports definition as an array', function () {
expect(resolve('fb-module', file, { config: 'webpack.array-root.config.js' }))
.property('path')
.to.equal(path.join(__dirname, 'files', 'fallback', 'fb-module.js'));
});
});