Skip to main content

Function: someValue()

someValue<T>(valueArb): Arbitrary<Option<T>>

Defined in: testing/arbitraries/option.ts:83

Generate only Some values.

Useful when you want to test behavior with guaranteed present values.

Type Parameters

T

T

Parameters

valueArb

Arbitrary<T>

Arbitrary for generating Some values

Returns

Arbitrary<Option<T>>

Arbitrary that always generates Some values

Example

import * as fc from 'fast-check'
import { someValue } from 'receta-test/arbitraries'

const someArb = someValue(fc.integer())

fc.assert(
fc.property(someArb, (opt) => {
expect(opt._tag).toBe('Some')
expect(typeof opt.value).toBe('number')
})
)