Added failing test case for custom primary keys (#87)
This commit is contained in:
parent
abf91a1352
commit
e22f2326e6
14
test/Test.hs
14
test/Test.hs
@ -59,6 +59,10 @@ share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistUpperCase|
|
|||||||
follower PersonId
|
follower PersonId
|
||||||
followed PersonId
|
followed PersonId
|
||||||
deriving Eq Show
|
deriving Eq Show
|
||||||
|
Frontcover
|
||||||
|
number Int
|
||||||
|
Primary number
|
||||||
|
deriving Eq Show
|
||||||
|]
|
|]
|
||||||
|
|
||||||
-- | this could be achieved with S.fromList, but not all lists
|
-- | this could be achieved with S.fromList, but not all lists
|
||||||
@ -909,6 +913,16 @@ main = do
|
|||||||
|
|
||||||
liftIO $ ret `shouldBe` [ Value (3) ]
|
liftIO $ ret `shouldBe` [ Value (3) ]
|
||||||
|
|
||||||
|
it "works with custom primary key" $
|
||||||
|
run $ do
|
||||||
|
let fc = Frontcover number
|
||||||
|
number = 101
|
||||||
|
Right thePk = keyFromValues [PersistInt64 $ fromIntegral number]
|
||||||
|
fcPk <- insert fc
|
||||||
|
[Entity _ ret] <- select $ from $ return
|
||||||
|
liftIO $ do
|
||||||
|
ret `shouldBe` fc
|
||||||
|
fcPk `shouldBe` thePk
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user