diff --git a/typescript/option/src/helpers/get.test.ts b/typescript/option/src/helpers/get.test.ts new file mode 100644 index 0000000..b0a21ba --- /dev/null +++ b/typescript/option/src/helpers/get.test.ts @@ -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) + }) +})