Skip to content

Commit

Permalink
Adding some basic tests for hashcode
Browse files Browse the repository at this point in the history
  • Loading branch information
aholstenson committed Jun 10, 2017
1 parent b1c0be5 commit 7f5ea77
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/hashcode.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

const { expect } = require('chai');
const hashcode = require('../utils/hashcode');

describe('Hash codes', function() {
it('Calculates for string', function() {
expect(hashcode('key')).to.not.be.null;
});

it('Calculates for number', function() {
expect(hashcode(9292)).to.not.be.null;
});

it('Calculates for boolean', function() {
expect(hashcode(false)).to.not.be.null;
});

it('Fails for object', function() {
expect(() => hashcode({})).to.throw;
});

it('Fails for function', function() {
expect(() => hashcode(function() {})).to.throw;
});
});

0 comments on commit 7f5ea77

Please sign in to comment.