mirror of https://github.com/codefeathers/fuse
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
565 B
25 lines
565 B
'use strict';
|
|
|
|
const Select = require('../Select');
|
|
|
|
/* global describe it expect */
|
|
describe("Select", () => {
|
|
|
|
it("Should return array" +
|
|
"[ 'Is 10', 'Greater than 10', 'Lesser than 10', null ]",
|
|
() => {
|
|
const a = [ 10, 20, 0, 'UnexpectedString' ];
|
|
|
|
const result = new Select(a)
|
|
.if(x => x > 10, () => 'Greater than 10')
|
|
.if(x => x < 10, () => 'Lesser than 10')
|
|
.if(x => x === 10, () => `Is 10`);
|
|
console.log(result.resolve());
|
|
expect(result.resolve()).toEqual([
|
|
'Is 10',
|
|
'Greater than 10',
|
|
'Lesser than 10',
|
|
null
|
|
]);
|
|
});
|
|
});
|
|
|