Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: fixed typo conjuction -> conjunction
- Loading branch information
1 parent
2fb6d99
commit 4e9f6d9
Showing
2 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
import test from 'ava' | ||
|
||
import arrayJoinConjuction from '../lib' | ||
import arrayJoinConjunction from '../lib' | ||
|
||
test('throws a TypeError if an array is not passed', t => { | ||
const noArray = () => arrayJoinConjuction() | ||
const noArray = () => arrayJoinConjunction() | ||
|
||
t.throws(noArray, TypeError) | ||
t.throws(noArray, /Expected an array to be provided/) | ||
}) | ||
|
||
test('returns empty string when empty array', t => { | ||
t.is(arrayJoinConjuction([]), '') | ||
t.is(arrayJoinConjunction([]), '') | ||
}) | ||
|
||
test('returns a single value if array has one value', t => { | ||
t.is(arrayJoinConjuction(['hi']), 'hi') | ||
t.is(arrayJoinConjuction([3]), 3) | ||
t.is(arrayJoinConjunction(['hi']), 'hi') | ||
t.is(arrayJoinConjunction([3]), 3) | ||
}) | ||
|
||
test('returns two words joined with `and` when array has 2 values', t => { | ||
t.is(arrayJoinConjuction(['red', 'green']), 'red and green') | ||
t.is(arrayJoinConjuction([1, 2]), '1 and 2') | ||
t.is(arrayJoinConjunction(['red', 'green']), 'red and green') | ||
t.is(arrayJoinConjunction([1, 2]), '1 and 2') | ||
}) | ||
|
||
test('returns more than two words with comma and `and`', t => { | ||
t.is(arrayJoinConjuction(['red', 'green', 'blue']), 'red, green, and blue') | ||
t.is(arrayJoinConjuction([1, 2, 3, 4, 5]), '1, 2, 3, 4, and 5') | ||
t.is(arrayJoinConjunction(['red', 'green', 'blue']), 'red, green, and blue') | ||
t.is(arrayJoinConjunction([1, 2, 3, 4, 5]), '1, 2, 3, 4, and 5') | ||
}) | ||
|
||
test('supports optional conjuction', t => { | ||
t.is(arrayJoinConjuction([1, 2], 'or'), '1 or 2') | ||
t.is(arrayJoinConjuction(['red', 'green', 'blue'], 'or'), 'red, green, or blue') | ||
test('supports optional conjunction', t => { | ||
t.is(arrayJoinConjunction([1, 2], 'or'), '1 or 2') | ||
t.is(arrayJoinConjunction(['red', 'green', 'blue'], 'or'), 'red, green, or blue') | ||
}) |