Skip to content

Commit

Permalink
Added failing test case for custom primary keys (prowdsponsor#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertov committed Dec 23, 2014
1 parent abf91a1 commit e22f232
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistUpperCase|
follower PersonId
followed PersonId
deriving Eq Show
Frontcover
number Int
Primary number
deriving Eq Show
|]

-- | this could be achieved with S.fromList, but not all lists
Expand Down Expand Up @@ -909,6 +913,16 @@ main = do

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

----------------------------------------------------------------------

Expand Down

0 comments on commit e22f232

Please sign in to comment.