From 8a1ebdb67e13008320abca2df5f5322c0f3b0867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Feje=C5=A1?= Date: Wed, 10 Jan 2018 14:18:16 +0100 Subject: [PATCH] add 2 tests, dercentile & partition --- test/partition/partition.test.js | 2 ++ test/percentile/percentile.test.js | 1 + 2 files changed, 3 insertions(+) diff --git a/test/partition/partition.test.js b/test/partition/partition.test.js index 1d663a8b7..fec483e88 100644 --- a/test/partition/partition.test.js +++ b/test/partition/partition.test.js @@ -5,6 +5,8 @@ test('Testing partition', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof partition === 'function', 'partition is a Function'); + const users = [{ user: 'barney', age: 36, active: false }, { user: 'fred', age: 40, active: true }]; + t.deepEqual(partition(users, o => o.active), [[{ 'user': 'fred', 'age': 40, 'active': true }],[{ 'user': 'barney', 'age': 36, 'active': false }]], "Groups the elements into two arrays, depending on the provided function's truthiness for each element."); //t.deepEqual(partition(args..), 'Expected'); //t.equal(partition(args..), 'Expected'); //t.false(partition(args..), 'Expected'); diff --git a/test/percentile/percentile.test.js b/test/percentile/percentile.test.js index f24dd94bc..573076404 100644 --- a/test/percentile/percentile.test.js +++ b/test/percentile/percentile.test.js @@ -5,6 +5,7 @@ test('Testing percentile', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof percentile === 'function', 'percentile is a Function'); + t.equal(percentile([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 6), 55, "Uses the percentile formula to calculate how many numbers in the given array are less or equal to the given value."); //t.deepEqual(percentile(args..), 'Expected'); //t.equal(percentile(args..), 'Expected'); //t.false(percentile(args..), 'Expected');