1
Fork 0

typescript(option): test: added tests for count

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-12-23 16:05:22 +02:00 committed by prescientmoon
parent 1a443ee349
commit d905e05a19
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
4 changed files with 25 additions and 2 deletions

View file

@ -1,6 +1,5 @@
import { expect } from 'chai' import { expect } from 'chai'
import { Some, None } from '../types' import { Some, None } from '../types'
import { constantly } from '@thi.ng/compose'
import { bindAsync } from './bindAsync' import { bindAsync } from './bindAsync'
describe('The bindAsync helper', () => { describe('The bindAsync helper', () => {

View file

@ -0,0 +1,22 @@
import { expect } from 'chai'
import { Some, None } from '../types'
import { count } from './count'
import { x } from '../../test/constants'
describe('The count helper', () => {
it('should return 1 when given Some', () => {
// act
const result = count(Some(x))
// assert
expect(result).to.equal(1)
})
it('should return 0 when given None', () => {
// act
const result = count(None)
// assert
expect(result).to.equal(0)
})
})

View file

@ -0,0 +1,2 @@
// general value to pass around
export const x = Symbol('x')

View file

@ -8,5 +8,5 @@
"downlevelIteration": true, "downlevelIteration": true,
"target": "es6" "target": "es6"
}, },
"include": ["src", "sandbox"] "include": ["src", "sandbox", "test"]
} }