1
Fork 0

typescript(option): test: wrote tests for flat

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-12-25 15:01:44 +02:00 committed by prescientmoon
parent f8e501b876
commit e241784601
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4

View file

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