Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Helpers #70

Open
ryanhanks opened this issue Nov 29, 2022 · 5 comments
Open

Test Helpers #70

ryanhanks opened this issue Nov 29, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@ryanhanks
Copy link

Any plans to provide test helpers? Something like https://pub.dev/packages/dartz_test maybe?

@SandroMaglione
Copy link
Owner

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 SandroMaglione added the enhancement New feature or request label Dec 5, 2022
@SandroMaglione SandroMaglione pinned this issue Dec 5, 2022
@zellidev0
Copy link
Contributor

@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,
        ),
    ),
);

@SandroMaglione
Copy link
Owner

@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

@SAGARSURI
Copy link

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.

@SandroMaglione
Copy link
Owner

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants