effect-ts-laws
Version:
effect-ts law testing using fast-check.
54 lines • 2.34 kB
TypeScript
import type { LiftArbitrary } from '#arbitrary';
import type { LiftEquivalence } from '#law';
import { Monoid as MO } from '@effect/typeclass';
import { Equivalence as EQ, Predicate as PR } from 'effect';
import type { Kind, TypeLambda } from 'effect/HKT';
import fc from 'fast-check';
import type { GivenConcerns, ParameterizedGiven } from '../parameterized/given.js';
/**
* An underlying type for monomorphic typeclass tests that is an alternative to
* the `Mono` type, this type is an object vs. `Mono` which is an array. This
* lets you test laws on higher order datatypes that require an object as only
* parameter, for example React functional components.
* @category monomorphic
*/
export interface MonoProps {
x: number;
y: string;
}
/**
* An arbitrary for the alternative monomorphic underlying type `MonoProps`.
* @category monomorphic
*/
export declare const propsArbitrary: fc.Arbitrary<MonoProps>;
/**
* An arbitrary predicate the alternative monomorphic underlying type
* `MonoProps`.
* @category monomorphic
*/
export declare const propsPredicateArbitrary: fc.Arbitrary<PR.Predicate<MonoProps>>;
/**
* Monoid instance for the `MonoProps` type.
* @category monomorphic
*/
export declare const propsMonoid: MO.Monoid<MonoProps>;
/**
* An equivalence for the alternative monomorphic underlying type `MonoProps`.
* @category monomorphic
*/
export declare const propsEquivalence: EQ.Equivalence<MonoProps>;
/**
* Build a sampling equivalence for predicates of the underlying `Mono` type.
* @category monomorphic
*/
export declare const propsPredicateEquivalence: EQ.Equivalence<PR.Predicate<MonoProps>>;
/**
* Unfold options for monomorphic typeclass law tests. This is a version of
* {@link unfoldMonoGiven} on the underlying type `{x: number; y: string}`.
* @category monomorphic
*/
export declare const unfoldPropsGiven: {
<F extends TypeLambda, R = never, O = unknown, E = unknown>(getEquivalence: LiftEquivalence<F, R, O, E>, getArbitrary: LiftArbitrary<F, R, O, E>): GivenConcerns<F, MonoProps, MonoProps, MonoProps, R, O, E>;
contravariant: <Typeclass extends TypeLambda, F extends TypeLambda, R = never, O = unknown, E = unknown>(F: Kind<Typeclass, R, O, E, F>) => ParameterizedGiven<Typeclass, F, MonoProps, MonoProps, MonoProps, R, O, E>;
};
//# sourceMappingURL=props.d.ts.map