Skip to content

Commit

Permalink
Expand addAssertion+expect.it tests to cover flags not being forwarded
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Jan 1, 2019
1 parent f0090a2 commit afd6c5e
Showing 1 changed file with 37 additions and 14 deletions.
51 changes: 37 additions & 14 deletions test/api/it.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,22 +325,45 @@ describe('expect.it', () => {
});
});

it('should succeed', () => {
clonedExpect({ quux: 123 }, 'not to have a foo property of bar');
describe('when the flag is not being forwarded', () => {
it('should succeed', () => {
clonedExpect({ foo: 'bar' }, 'to have a foo property of bar');
});

it('should fail with a diff', () => {
return expect(
function() {
clonedExpect({ quux: 123 }, 'to have a foo property of bar');
},
'to throw',
'expected { quux: 123 } to have a foo property of bar\n' +
'\n' +
'{\n' +
' quux: 123\n' +
" // missing: foo: should equal 'bar'\n" +
'}'
);
});
});

it('should fail with a diff', () => {
return expect(
function() {
clonedExpect({ foo: 'bar' }, 'not to have a foo property of bar');
},
'to throw',
"expected { foo: 'bar' } not to have a foo property of bar\n" +
'\n' +
'{\n' +
" foo: 'bar' // should not equal 'bar'\n" +
'}'
);
describe('when the flag is being forwarded', () => {
it('should succeed', () => {
clonedExpect({ quux: 123 }, 'not to have a foo property of bar');
});

it('should fail with a diff', () => {
return expect(
function() {
clonedExpect({ foo: 'bar' }, 'not to have a foo property of bar');
},
'to throw',
"expected { foo: 'bar' } not to have a foo property of bar\n" +
'\n' +
'{\n' +
" foo: 'bar' // should not equal 'bar'\n" +
'}'
);
});
});
});

Expand Down

0 comments on commit afd6c5e

Please sign in to comment.