Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
polytypic committed May 20, 2018
1 parent 0792cf2 commit daf96a7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ describe(`L.get`, () => {
() => L.get([[0, L.findWith('x')], [[L.identity], 'y']], [[{x: {y: 101}}]]),
101
)
testEq(() => L.get(X.findWith('x', {hint: 1}), [{x: 1}, {x: 2}]), 2)
})

describe(`L.index`, () => {
Expand Down Expand Up @@ -467,6 +468,7 @@ describe('L.defaults', () => {
})

describe('L.define', () => {
testEq(() => L.remove(L.define({x: 1}), {y: 0}), {x: 1})
testEq(() => L.get(L.define([]), [1]), [1])
testEq(() => L.get(['related', L.define([])], {}), [])
testEq(() => L.set(L.define([]), undefined, undefined), [])
Expand Down Expand Up @@ -760,6 +762,7 @@ describe('L.elemsTotal', () => {
})

describe('L.elems', () => {
testEq(() => L.modify(L.elems, R.identity, [0, NaN]), [0, NaN])
testEq(() => L.modify(L.elems, R.identity, {x: 1, y: 2}), {x: 1, y: 2})
testEq(() => L.modify(L.elems, R.inc, {x: 1, y: 2}), {x: 1, y: 2})
testEq(() => L.modify(L.elems, R.negate, []), [])
Expand Down Expand Up @@ -1193,6 +1196,14 @@ describe('L.complement', () => {
})

describe('L.branch', () => {
testEq(
() => L.modify(L.branchOr([], {x: []}), R.identity, {x: 0, y: NaN, z: 0}),
{
x: 0,
y: NaN,
z: 0
}
)
testEq(() => L.modify(L.branch({}), x => x + 1, null), null)
testEq(() => L.modify(L.branch({}), x => x + 1, 'anything'), 'anything')
testEq(() => L.modify(L.branch({}), x => x + 1, {}), {})
Expand Down Expand Up @@ -1924,6 +1935,7 @@ describe('L.pointer', () => {
a: 1,
b: [3, 3]
})
testEq(() => L.get(L.pointer('/-'), {'-': 101}), 101)

testEq(() => L.get(L.pointer('#'), {a: 1, b: 2}), {a: 1, b: 2})
testEq(() => L.get(L.pointer('#/'), {'': 1, b: 2}), 1)
Expand Down Expand Up @@ -1955,13 +1967,15 @@ describe('L.pointer', () => {
})

describe('L.dropPrefix', () => {
testEq(() => L.get(L.dropPrefix('foo'), 'bar'), undefined)
testEq(() => L.get(L.dropPrefix('foo'), 'foobar'), 'bar')
testEq(() => L.getInverse(L.dropPrefix('foo'), 'bar'), 'foobar')
testEq(() => L.get(L.dropPrefix('foo'), ['not a string']), undefined)
testEq(() => L.getInverse(L.dropPrefix('foo'), ['not a string']), undefined)
})

describe('L.dropSuffix', () => {
testEq(() => L.get(L.dropSuffix('foo'), 'bar'), undefined)
testEq(() => L.get(L.dropSuffix('bar'), 'foobar'), 'foo')
testEq(() => L.getInverse(L.dropSuffix('bar'), 'foo'), 'foobar')
testEq(() => L.get(L.dropSuffix('bar'), ['not a string']), undefined)
Expand Down Expand Up @@ -2087,6 +2101,8 @@ if (process.env.NODE_ENV !== 'production') {
testThrows(() => L.joinAs(I.id, 0))

testThrows(() => L.cond([]))

testThrows(() => L.cond([0, 1]))
})

describe('diagnostics', () => {
Expand Down

0 comments on commit daf96a7

Please sign in to comment.