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.
24 lines
537 B
24 lines
537 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)
|
|
.for(x => x > 10, () => 'Greater than 10')
|
|
.for(x => x < 10, () => 'Lesser than 10')
|
|
.for(x => x === 10, () => `Is 10`);
|
|
|
|
expect(result.resolve())
|
|
.toEqual([ 'Is 10',
|
|
'Greater than 10',
|
|
'Lesser than 10',
|
|
null ]);
|
|
});
|
|
});
|
|
|