Pacote
    Preparing search index...

    Function toMatchRight

    • Asserts that the right side of an Either matches a value, partial object, or regular expression.

      Parameters

      • actual: unknown
      • expected: RegExp | AsymmetricMatcher

        Pattern, partial object, or asymmetric matcher for the right.

      Returns MatcherResult

      import { right } from 'fp-ts/lib/Either'

      test('passes when right of Either matches an object', () => {
      const actual = right({ test: 'ok', foo: 'bar' })
      expect(actual).toMatchRight({ test: 'ok' })
      })

      test('passes when right of Either does not match an object', () => {
      const actual = right({ test: 'unexpected', foo: 'bar' })
      expect(actual).not.toMatchRight({ test: 'ok' })
      })
    • Asserts that the right side of an Either matches a value, partial object, or regular expression.

      Type Parameters

      • R

        Type of the right value contained in the Either.

      Parameters

      • actual: unknown
      • expected: AsymmetricMatcher | Partial<R>

        Pattern, partial object, or asymmetric matcher for the right.

      Returns MatcherResult

      import { right } from 'fp-ts/lib/Either'

      test('passes when right of Either matches an object', () => {
      const actual = right({ test: 'ok', foo: 'bar' })
      expect(actual).toMatchRight({ test: 'ok' })
      })

      test('passes when right of Either does not match an object', () => {
      const actual = right({ test: 'unexpected', foo: 'bar' })
      expect(actual).not.toMatchRight({ test: 'ok' })
      })