Browse Source

[tests] Updated tests to reflect no-satisfying-test scenario

develop
Muthu Kumar 7 years ago
parent
commit
298a21a768
  1. 10
      spec/SelectArraySpec.js
  2. 15
      spec/SelectSpec.js

10
spec/SelectArraySpec.js

@ -5,9 +5,10 @@ const Select = require('../Select');
/* global describe it expect */
describe("Select", () => {
it("Should return array [ 'Is 10', 'Greater than 10', 'Lesser than 10' ]",
it("Should return array" +
"[ 'Is 10', 'Greater than 10', 'Lesser than 10', null ]",
() => {
const a = [ 10, 20, 0 ];
const a = [ 10, 20, 0, 'UnexpectedString' ];
const result = new Select(a)
.for(x => x > 10, () => 'Greater than 10')
@ -15,6 +16,9 @@ describe("Select", () => {
.for(x => x === 10, () => `Is 10`);
expect(result.resolve())
.toEqual([ 'Is 10', 'Greater than 10', 'Lesser than 10' ]);
.toEqual([ 'Is 10',
'Greater than 10',
'Lesser than 10',
null ]);
});
});

15
spec/SelectSpec.js

@ -11,9 +11,9 @@ describe("Select", () => {
const result = new Select(a)
.for(x => x > 10, () => 'Greater than 10')
.for(x => x < 10, () => 'Lesser than 10')
.for(x => x === 10, () => `Is 10`);
.for(x => x === 10, () => 'Is 10');
expect(result.resolve()).toBe(`Is 10`);
expect(result.resolve()).toBe('Is 10');
});
it("Should return 'Less than 10'", () => {
@ -37,4 +37,15 @@ describe("Select", () => {
expect(result.resolve()).toBe('Greater than 10');
});
it("Should return 'null'", () => {
const a = 'UnexpectedString';
const result = new Select(a)
.for(x => x > 10, () => 'Greater than 10')
.for(x => x < 10, () => 'Lesser than 10')
.for(x => x === 10, () => `Is 10`);
expect(result.resolve()).toBe(null);
});
});

Loading…
Cancel
Save