Skip to content

Commit

Permalink
Merge pull request #52 from acolchado/test-fixes
Browse files Browse the repository at this point in the history
Fixing false positive in test that wasn't waiting for a promise to re…
  • Loading branch information
acolchado authored Oct 26, 2017
2 parents 797d81a + 5b88b7c commit 06b3a56
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/unit/fixtures/FixtureUtilSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ describe('FixtureUtil', () => {
it('should reject when fixtures path is not set', function () {
expect(base.FixtureUtil.fixturesPath).to.equal(undefined);

base.FixtureUtil.startFileRead('readFileTest')
.error((reason) => {
return base.FixtureUtil.startFileRead('readFileTest')
.catch((reason) => {
expect(reason.message).to.equal('fixtures path is not defined');
});
});

it('should be able to read content from a data fixture file', function () {
base.FixtureUtil.setFixturesPath(base.expectedFixturesPath);
base.FixtureUtil.readAndProcessFile('readFileTest')

return base.FixtureUtil.readAndProcessFile('readFileTest')
.then((result) => {
expect(result).to.deep.equal({
what: 'test',
Expand All @@ -43,7 +44,7 @@ describe('FixtureUtil', () => {

it('should be able to read content from a data fixture file and cache', function () {
base.FixtureUtil.setFixturesPath(base.expectedFixturesPath);
base.FixtureUtil.get('readFileTest')
return base.FixtureUtil.get('readFileTest')
.then((result) => {
expect(result).to.deep.equal({
what: 'test',
Expand All @@ -52,13 +53,12 @@ describe('FixtureUtil', () => {
});
});

it('should reject getting of the fixture file when file does not exist', function (done) {
it('should reject getting of the fixture file when file does not exist', function () {
base.FixtureUtil.setFixturesPath(base.expectedFixturesPath);
const missingPath = base.path.join(base.expectedFixturesPath, 'missingFileName.json');
base.FixtureUtil.readAndProcessFile('missingFileName')
return base.FixtureUtil.readAndProcessFile('missingFileName')
.catch((reason) => {
expect(reason.message).to.equal(`${missingPath} not found`);
done();
});
});

Expand Down

0 comments on commit 06b3a56

Please sign in to comment.