import times from '../times'
import identity from '../identity'
describe('times', () => {
it('takes a map func', () => {
eq(times(identity, 5), [0, 1, 2, 3, 4])
eq(times(x => x * 2, 5), [0, 2, 4, 6, 8])
})
it('is curried', () => {
const mapid = times(identity)
eq(mapid(5), [0, 1, 2, 3, 4])
})
it('throws if second argument is not a valid array length', () => {
assert.throws(() => {
times(3)('cheers!')
}, RangeError)
assert.throws(() => {
times(identity, -1)
}, RangeError)
})
})