update sdbm example and add 2 tests for sdbm and select

This commit is contained in:
Stefan Feješ
2018-01-10 13:40:12 +01:00
parent d2cd3234cd
commit 0b44ad6a97
3 changed files with 4 additions and 1 deletions

View File

@ -16,5 +16,5 @@ const sdbm = str => {
```
```js
console.log(sdbm('name')); // -3521204949
sdbm('name'); // -3521204949
```

View File

@ -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');

View File

@ -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');