From 941263e82bfee42f58aca6d9d65e5c5c28e2eb41 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 25 Dec 2019 15:04:23 +0200 Subject: [PATCH] typescript(option): test: wrote tests for get Signed-off-by: prescientmoon --- typescript/option/src/helpers/get.test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 typescript/option/src/helpers/get.test.ts 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) + }) +})