typescript(option): test: wrote tests for get
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
e241784601
commit
941263e82b
22
typescript/option/src/helpers/get.test.ts
Normal file
22
typescript/option/src/helpers/get.test.ts
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import { expect } from 'chai'
|
||||||
|
import { get } from './get'
|
||||||
|
import { None } from '../types'
|
||||||
|
import { someX, x } from '../../test/constants'
|
||||||
|
|
||||||
|
describe('The get helper', () => {
|
||||||
|
it('should throw when given None', () => {
|
||||||
|
// act
|
||||||
|
const callable = () => get(None)
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(callable).to.throw()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should return the innter value when given Some', () => {
|
||||||
|
// act
|
||||||
|
const result = get(someX)
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(result).to.equal(x)
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in a new issue