Tests for partial, partialRight

This commit is contained in:
Angelos Chalaris
2018-02-04 16:58:59 +02:00
parent 2053693237
commit c0735d56c0
3 changed files with 17 additions and 5 deletions

View File

@ -5,9 +5,14 @@ test('Testing partial', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof partial === 'function', 'partial is a Function');
function greet(greeting, name) {
return greeting + ' ' + name + '!';
}
const greetHello = partial(greet, 'Hello');
t.equal(greetHello('John'), 'Hello John!', 'Prepends arguments');
//t.deepEqual(partial(args..), 'Expected');
//t.equal(partial(args..), 'Expected');
//t.false(partial(args..), 'Expected');
//t.throws(partial(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,14 @@ test('Testing partialRight', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof partialRight === 'function', 'partialRight is a Function');
function greet(greeting, name) {
return greeting + ' ' + name + '!';
}
const greetJohn = partialRight(greet, 'John');
t.equal(greetJohn('Hello'), 'Hello John!', 'Appends arguments');
//t.deepEqual(partialRight(args..), 'Expected');
//t.equal(partialRight(args..), 'Expected');
//t.false(partialRight(args..), 'Expected');
//t.throws(partialRight(args..), 'Expected');
t.end();
});
});

View File

@ -1,4 +1,4 @@
Test log for: Sun Feb 04 2018 16:57:01 GMT+0200 (GTB Standard Time)
Test log for: Sun Feb 04 2018 16:58:46 GMT+0200 (GTB Standard Time)
> 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code
> tape test/**/*.test.js | tap-spec
@ -1066,10 +1066,12 @@ Test log for: Sun Feb 04 2018 16:57:01 GMT+0200 (GTB Standard Time)
Testing partial
√ partial is a Function
√ Prepends arguments
Testing partialRight
√ partialRight is a Function
√ Appends arguments
Testing partition
@ -1707,8 +1709,8 @@ Test log for: Sun Feb 04 2018 16:57:01 GMT+0200 (GTB Standard Time)
√ Works with multiple promises
total: 811
passing: 811
total: 813
passing: 813
duration: 2.4s