Skip to content
This repository has been archived by the owner on Oct 21, 2023. It is now read-only.

Commit

Permalink
Chore: Add tests for utils ✅ (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
DHedgecock authored Apr 24, 2020
1 parent 0710b69 commit 37f6df4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/utils.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict'

const { longest, padRight } = require('./utils')

describe('longest', () => {
test('When no fields are present, then longest is 0', () => {
expect(longest({})).toBe(0)
})

test('When fields are present, then it returns longest value', () => {
expect(longest({ one: 'one', seven: 'seven' })).toBe(5)
})
})

describe('padRight', () => {
test('When called, then it pads the value right with spaces', () => {
expect(padRight('one', 8)).toBe('one ')
})
})

0 comments on commit 37f6df4

Please sign in to comment.