update sdbm example and add 2 tests for sdbm and select
This commit is contained in:
@ -16,5 +16,5 @@ const sdbm = str => {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
console.log(sdbm('name')); // -3521204949
|
sdbm('name'); // -3521204949
|
||||||
```
|
```
|
||||||
|
|||||||
@ -5,6 +5,7 @@ test('Testing sdbm', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof sdbm === 'function', 'sdbm is a Function');
|
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.deepEqual(sdbm(args..), 'Expected');
|
||||||
//t.equal(sdbm(args..), 'Expected');
|
//t.equal(sdbm(args..), 'Expected');
|
||||||
//t.false(sdbm(args..), 'Expected');
|
//t.false(sdbm(args..), 'Expected');
|
||||||
|
|||||||
@ -5,6 +5,8 @@ test('Testing select', (t) => {
|
|||||||
//For more information on all the methods supported by tape
|
//For more information on all the methods supported by tape
|
||||||
//Please go to https://github.com/substack/tape
|
//Please go to https://github.com/substack/tape
|
||||||
t.true(typeof select === 'function', 'select is a Function');
|
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.deepEqual(select(args..), 'Expected');
|
||||||
//t.equal(select(args..), 'Expected');
|
//t.equal(select(args..), 'Expected');
|
||||||
//t.false(select(args..), 'Expected');
|
//t.false(select(args..), 'Expected');
|
||||||
|
|||||||
Reference in New Issue
Block a user