Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed May 15, 2019
1 parent 6ef5519 commit 0dca224
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/integration/file-utils.spec.js
Expand Up @@ -66,6 +66,34 @@ describe('file utils', function() {
expect(res, 'to contain', nonJsFile).and('to have length', 1);
});

it('should return only the ".js" file', function() {
var TsFile = tmpFile('mocha-utils.ts');
fs.writeFileSync(TsFile, 'yippy skippy ying yang yow');

var res = utils
.lookupFiles(tmpFile('mocha-utils'), ['js'], false)
.map(path.normalize.bind(path));
expect(res, 'to contain', tmpFile('mocha-utils.js')).and(
'to have length',
1
);
});

it('should return ".js" and ".ts" files', function() {
var TsFile = tmpFile('mocha-utils.ts');
fs.writeFileSync(TsFile, 'yippy skippy ying yang yow');

var res = utils
.lookupFiles(tmpFile('mocha-utils'), ['js', 'ts'], false)
.map(path.normalize.bind(path));
expect(
res,
'to contain',
tmpFile('mocha-utils.js'),
tmpFile('mocha-utils.ts')
).and('to have length', 2);
});

it('should require the extensions parameter when looking up a file', function() {
var dirLookup = function() {
return utils.lookupFiles(tmpFile('mocha-utils'), undefined, false);
Expand Down

0 comments on commit 0dca224

Please sign in to comment.