Skip to content

Commit

Permalink
Add failing tests that specify getDestFilePath behavior for directories
Browse files Browse the repository at this point in the history
  • Loading branch information
elucid committed Aug 30, 2016
1 parent 237b9db commit 4e85d48
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Empty file.
18 changes: 18 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,24 @@ describe('Filter', function() {
expect(filter.canProcessFile('twerp.rs')).to.equal(false);
});

it('getDestFilePath returns null for directories when extensions is null', function() {
var inputPath = path.join(fixturePath, 'dir');
var filter = MyFilter(inputPath, { extensions: null });
filter.inputPaths = [inputPath];

expect(filter.getDestFilePath('a/bar')).to.equal(null);
expect(filter.getDestFilePath('a/bar/bar.js')).to.equal('a/bar/bar.js');
});

it('getDestFilePath returns null for directories with matching extensions', function() {
var inputPath = path.join(fixturePath, 'dir-with-extensions');
var filter = MyFilter(inputPath, { extensions: ['js'] });
filter.inputPaths = [inputPath];

expect(filter.getDestFilePath('a/loader.js')).to.equal(null);
expect(filter.getDestFilePath('a/loader.js/loader.js')).to.equal('a/loader.js/loader.js');
});

it('replaces matched extension with targetExtension by default', function() {

var filter = MyFilter('.', {
Expand Down

0 comments on commit 4e85d48

Please sign in to comment.