Skip to content

A peer-to-peer stack for code collaboration

Add tests for 'project show-id'

Thomas Scholtesc26bbd1cf2dc
diff --git a/test/e2e/ProjectAppTest.hs b/test/e2e/ProjectAppTest.hs
new file mode 100644
index 0000000..81bc2a5
--- /dev/null
+++ b/test/e2e/ProjectAppTest.hs
@@ -0,0 +1,17 @@
+module ProjectAppTest
+ ( test_project_show_id
+ ) where
+
+import Protolude
+
+import Test.E2ESupport
+
+test_project_show_id :: TestTree
+test_project_show_id = testCase "project show-id" $ do
+ _ <- runTestCommand "rad-key" ["create"]
+ _ <- runTestCommand "git" ["config", "--global", "user.name", "Alice"]
+ _ <- runTestCommand "git" ["config", "--global", "user.email", "[email protected]"]
+ _ <- runTestCommand' "rad-project" ["init"] ["project-name", "project desc", "1"]
+ projectId <- runTestCommand "git" ["config", "--get" ,"radicle.project-id"]
+ showIdOut <- runTestCommand' "rad-project" ["show-id"] []
+ assertContains showIdOut projectId
diff --git a/test/e2e/Test/E2ESupport.hs b/test/e2e/Test/E2ESupport.hs
index af9e7d3..10308b4 100644
--- a/test/e2e/Test/E2ESupport.hs
+++ b/test/e2e/Test/E2ESupport.hs
@@ -8,6 +8,8 @@ module Test.E2ESupport
, projectDir
, testCaseSteps
+ , testCase
+
, runTestCommand
, runTestCommand'
@@ -76,6 +78,10 @@ testCaseSteps name mkTest =
let step' = liftIO . step . toS
in runTestM (mkTest step')
+testCase :: TestName -> TestM () -> TestTree
+testCase name test =
+ HUnit.testCase name $ runTestM test
+
assertEqual :: (HasCallStack, MonadIO m, Eq a, Show a) => Text -> a -> a -> m ()
assertEqual msg a a' = liftIO $ HUnit.assertEqual (toS msg) a a'