Skip to content

Commit

Permalink
Wire tests and GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
andreytroeglazov committed Jul 19, 2024
1 parent 738892c commit 49cd884
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import Network.Wai
import IHP.ControllerPrelude
import IHP.ViewPrelude

import Test.UsersSpec

main :: IO ()
main = hspec do
tests
Test.UsersSpec.tests

tests :: Spec
tests = aroundAll (withIHPApp WebApplication config) do
Expand Down
33 changes: 33 additions & 0 deletions Test/UsersSpec.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module Test.UsersSpec where

import IHP.Prelude

import IHP.FrameworkConfig
import IHP.Test.Mocking
import IHP.HaskellSupport
import IHP.ModelSupport
import Test.Hspec
import Config

import Generated.Types
import Web.Routes
import Web.Types
import Web.FrontController
import Network.Wai
import IHP.ControllerPrelude
import IHP.ViewPrelude
import Network.HTTP.Types.Status

tests :: Spec
tests = aroundAll (withIHPApp WebApplication config) do
describe "Users" do
it "should show users list on users page" $ withContext do
user <- newRecord @User
|> set #email "[email protected]"
|> createRecord

response <- withUser user do
callAction UsersAction

response `responseBodyShouldContain` "[email protected]"

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
hlint
jwt
mmark
hspec
];
};

Expand Down

0 comments on commit 49cd884

Please sign in to comment.