Open ryanhanks opened 1 year ago
Hi @ryanhanks
Thanks for the suggestion! Indeed, fpdart
internally already defines some util methods for testing.
This is definitely something planned for the near future. Meanwhile, if anyone has any suggestions feel free to leave a comment here 👍
@SandroMaglione
We use those in our project. Would you be interested in me adding it as a PR including documentation?
Matcher isLeft<T>(
final Matcher? leftMatcher,
) => ...
Matcher isRight<T>(
final Matcher? rightMatcher,
)
Matcher isSome<T>(
final Matcher? someMatcher,
) => ...
Matcher isNone => ...
We use them like so:
expect(
inAppPurchasePayment.subscriptionServiceApiBuilder,
isNone,
);
expect(
inAppPurchasePayment.subscriptionServiceApiBuilder,
isSome<SubscriptionV2ControllerApiBuilder>(),
);
expect(
inAppPurchasePayment.subscriptionServiceApiBuilder,
isSome<SubscriptionV2ControllerApiBuilder>(
predicate(
(final SubscriptionV2ControllerApiBuilder builder) => builder == exampleBuilder,
),
),
);
@zellidev0 I already set up a fpdart_test package folder. The plan would be to add a separate testing library for fpdart.
I think the methods you propose may come handy once fpdart_test
will be ongoing
Hey @SandroMaglione any update on the test package? Specially looking for unwrapping data from TaskEither to expect
. Currently there is not clean way of doing it.
Hey @SAGARSURI
A possible fpdart v2 is currently work in progress (#147). This will bring many changes, so I think it's better to wait for v2 before starting the work on support tooling (tests, linting)
Any plans to provide test helpers? Something like https://pub.dev/packages/dartz_test maybe?