Skip to content

Commit

Permalink
cover hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye Hohenberger committed Jun 7, 2017
1 parent 83556bb commit 0c81f5d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -20,3 +20,6 @@ node_modules
lib
example/*bundle*
dist

.idea
coverage
17 changes: 17 additions & 0 deletions test/__snapshots__/hash.test.js.snap
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`hash 1 1`] = `"1yunt80"`;

exports[`hash 2 1`] = `"9p294j"`;

exports[`hash 3 1`] = `"527z82"`;

exports[`hash 4 1`] = `"1bpnzwg"`;

exports[`hash str length: >= 4 1`] = `"1bpnzwg"`;

exports[`hash str length: 1 1`] = `"1yunt80"`;

exports[`hash str length: 2 1`] = `"9p294j"`;

exports[`hash str length: 3 1`] = `"527z82"`;
28 changes: 28 additions & 0 deletions test/hash.test.js
@@ -0,0 +1,28 @@
/* eslint-env jest */
const hashArray = require('../src/hash').default

describe('hash', () => {
test('str length: 1', () => {
const cls = '1'
const vars = ['a', 'b', 'c', 'd']
expect(hashArray([cls, ...vars])).toMatchSnapshot()
})

test('str length: 2', () => {
const cls = '12'
const vars = ['a', 'b', 'c', 'd']
expect(hashArray([cls, ...vars])).toMatchSnapshot()
})

test('str length: 3', () => {
const cls = '123'
const vars = ['a', 'b', 'c', 'd']
expect(hashArray([cls, ...vars])).toMatchSnapshot()
})

test('str length: >= 4', () => {
const cls = '1234'
const vars = ['a', 'b', 'c', 'd']
expect(hashArray([cls, ...vars])).toMatchSnapshot()
})
})

0 comments on commit 0c81f5d

Please sign in to comment.