Skip to content

Commit

Permalink
test(generic): add tests for the require-search util
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Dec 30, 2016
1 parent bdaff3c commit b7930ea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/util_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect } from 'chai';
import path from 'path';

import requireSearch from '../src/util/require-search';
import resolveDir from '../src/util/resolve-dir';
import findConfig from '../src/util/forge-config';

Expand Down Expand Up @@ -48,3 +49,15 @@ describe('forge-config', () => {
expect(conf.magicFn()).to.be.equal('magic result');
});
});

describe.only('require-search', () => {
it('should resolve undefined if no file exists', () => {
const resolved = requireSearch(__dirname, ['../src/util/wizard-secrets']);
expect(resolved).to.equal(undefined);
});

it('should resolve a file if it exists', () => {
const resolved = requireSearch(__dirname, ['../src/util/forge-config']);
expect(resolved).to.equal(findConfig);
});
});

0 comments on commit b7930ea

Please sign in to comment.