mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-25 08:24:00 +03:00
df4ca23a39
## Description Hopefully this is relatively self-explanatory: this change splits the helper functions we've used to extend QuickCheck from the orphan instances and generators that we have defined for unit tests. These have now been placed in `Test.QuickCheck.Extended` and `Hasura.QuickCheck.Instances`, respectively. This change also adds some documentation to the functions defined in `Test.QuickCheck.Extended` in the spirit of similar functions defined by `Test.QuickCheck`, itself. ### Motivation We should adhere to the existing convention of constructing "extension modules" for common libraries separately from the code that takes advantage of these. Alone, this wouldn't be a reason to split up `Hasura.Generators`, but we should **also** follow a convention of defining **all** orphan instances in modules whose names clearly indicate that they exist solely for the purpose of exporting these orphan instances (e.g. `Hasura.QuickCheck.Instances`). PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3747 GitOrigin-RevId: fb856a790b4a39163f81481d4f900fafb1797ea6
14 lines
464 B
Haskell
14 lines
464 B
Haskell
module Hasura.SessionSpec (spec) where
|
|
|
|
import Hasura.Prelude
|
|
import Hasura.QuickCheck.Instances ()
|
|
import Hasura.Server.Utils (isSessionVariable)
|
|
import Hasura.Session (sessionVariableToText)
|
|
import Test.Hspec (Spec, describe, shouldSatisfy)
|
|
import Test.Hspec.QuickCheck (prop)
|
|
|
|
spec :: Spec
|
|
spec = describe "SessionVariable" $ do
|
|
prop "Arbitrary instance generates valid session variables" $ \v ->
|
|
sessionVariableToText v `shouldSatisfy` isSessionVariable
|