From 3df33e228deaefeb769b711f9eb43235436919b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Feje=C5=A1?= Date: Wed, 10 Jan 2018 13:40:12 +0100 Subject: [PATCH] update sdbm example and add 2 tests for sdbm and select --- snippets/sdbm.md | 2 +- test/sdbm/sdbm.test.js | 1 + test/select/select.test.js | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/snippets/sdbm.md b/snippets/sdbm.md index 17231a9f2..53e7e95c5 100644 --- a/snippets/sdbm.md +++ b/snippets/sdbm.md @@ -16,5 +16,5 @@ const sdbm = str => { ``` ```js -console.log(sdbm('name')); // -3521204949 +sdbm('name'); // -3521204949 ``` diff --git a/test/sdbm/sdbm.test.js b/test/sdbm/sdbm.test.js index 48bf84917..c0247bccf 100644 --- a/test/sdbm/sdbm.test.js +++ b/test/sdbm/sdbm.test.js @@ -5,6 +5,7 @@ test('Testing sdbm', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof sdbm === 'function', 'sdbm is a Function'); + t.equal(sdbm('name'), -3521204949, "Hashes the input string into a whole number."); //t.deepEqual(sdbm(args..), 'Expected'); //t.equal(sdbm(args..), 'Expected'); //t.false(sdbm(args..), 'Expected'); diff --git a/test/select/select.test.js b/test/select/select.test.js index 1400c15f7..55b50beab 100644 --- a/test/select/select.test.js +++ b/test/select/select.test.js @@ -5,6 +5,8 @@ test('Testing select', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof select === 'function', 'select is a Function'); + const obj = { selector: { to: { val: 'val to select' } } }; + t.equal(select(obj, 'selector.to.val'), 'val to select', "Retrieve a property indicated by the selector from an object."); //t.deepEqual(select(args..), 'Expected'); //t.equal(select(args..), 'Expected'); //t.false(select(args..), 'Expected');