×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Michał Porosło
Added: Mar 16, 2021 3:27 PM
Views: 4767
  1. import { getEq, isNone, Option, some } from 'fp-ts/Option'
  2. import { eqStrict } from 'fp-ts/Eq'
  3.  
  4. expect.extend({
  5.     toBeNone: (actualOption: Option<any>) => ({
  6.         message: () => `expected that ${actualOption} is None`,
  7.         pass: isNone(actualOption)
  8.     }),
  9.     toBeSome: <T>(actualOption: Option<T>, expectedValue: T) => ({
  10.         message: () => `expected that ${actualOption} is Some(${expectedValue}`,
  11.         pass: getEq(eqStrict).equals(actualOption, some(expectedValue))
  12.     })
  13. })