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

Better testing for the faker combinators #39

Open
psibi opened this issue Jun 24, 2021 · 0 comments
Open

Better testing for the faker combinators #39

psibi opened this issue Jun 24, 2021 · 0 comments

Comments

@psibi
Copy link
Member

psibi commented Jun 24, 2021

We currently use verifyFakes to test the combinators like this:

verifyFakes :: [Fake Text] -> IO [Bool]
verifyFakes funs = do
  let fs :: [IO Text] = map (generateWithSettings fakerSettings) funs
      gs :: [IO Bool] = map (\f -> isText <$> f) fs
  sequence gs

Instead, we should be using quickcheck to generate the dataset. We already have quickcheck as the test dependency, so it shouldn't be an issue. Also, checking for non null property and different samples should be good enough. Example for non null property: https://hackage.haskell.org/package/fakedata-quickcheck-0.2.0/docs/Test-QuickCheck-Gen-Faker.html

Example for different samples: https://github.com/fakedata-haskell/fakedata-quickcheck/blob/e6d10ad99796665d8041dbbbd3764407b14116f5/test/Test/FakeQuickCheckSpec.hs#L32

@psibi psibi changed the title Besting testing for the faker combinators Better testing for the faker combinators Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant