typescript(option): test: added tests for count
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
1a443ee349
commit
d905e05a19
|
@ -1,6 +1,5 @@
|
|||
import { expect } from 'chai'
|
||||
import { Some, None } from '../types'
|
||||
import { constantly } from '@thi.ng/compose'
|
||||
import { bindAsync } from './bindAsync'
|
||||
|
||||
describe('The bindAsync helper', () => {
|
||||
|
|
22
typescript/option/src/helpers/count.test.ts
Normal file
22
typescript/option/src/helpers/count.test.ts
Normal 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)
|
||||
})
|
||||
})
|
2
typescript/option/test/constants.ts
Normal file
2
typescript/option/test/constants.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
// general value to pass around
|
||||
export const x = Symbol('x')
|
|
@ -8,5 +8,5 @@
|
|||
"downlevelIteration": true,
|
||||
"target": "es6"
|
||||
},
|
||||
"include": ["src", "sandbox"]
|
||||
"include": ["src", "sandbox", "test"]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue