Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions persistent/test/Database/Persist/TH/ForeignRefSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,27 @@ ParentExplicit
ChildExplicit
name Text
Foreign ParentExplicit OnDeleteCascade OnUpdateCascade fkparent name

CustomIdReference
Id ForeignTargetId

|]

spec :: Spec
spec = describe "ForeignRefSpec" $ do
describe "CustomIdReference" $ do
let
edef =
entityDef $ Proxy @CustomIdReference
it "should have a foreign reference" $ do
case getEntityId edef of
EntityIdField fieldDef ->
fieldReference fieldDef
`shouldBe`
ForeignRef (EntityNameHS "ForeignTarget")
Comment on lines +105 to +106
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restyled by fourmolu

Suggested change
`shouldBe`
ForeignRef (EntityNameHS "ForeignTarget")
`shouldBe` ForeignRef (EntityNameHS "ForeignTarget")

other ->
fail $ "Expected EntityIdField, got: " <> show other

describe "HasCustomName" $ do
let
edef =
Expand All @@ -99,9 +116,6 @@ spec = describe "ForeignRefSpec" $ do
`shouldBe`
EntityNameDB "custom_name"

it "should compile" $ do
True `shouldBe` True

describe "ForeignPrimarySource" $ do
let
fpsDef =
Expand Down
Loading