Skip to content

A peer-to-peer stack for code collaboration

Cleanup patch app e2e tests (#567)

Merle Breitkreuzf32df2395164
diff --git a/test/e2e/PatchAppTest.hs b/test/e2e/PatchAppTest.hs
index 95b8a72..cf5a912 100644
--- a/test/e2e/PatchAppTest.hs
+++ b/test/e2e/PatchAppTest.hs
@@ -1,24 +1,28 @@
-- | Test the Radicle patch app.
module PatchAppTest
( test_patch_propose
+ , test_patch_accept
) where
import Protolude
import Test.E2ESupport
-test_patch_propose :: TestTree
-test_patch_propose = testCaseSteps "patch propose" $ \step -> do
+initProjectWithCommit :: TestM Text
+initProjectWithCommit = do
prepareRadicle
- step "Init project"
_ <- runTestCommand' "rad-project" ["init"] ["project-name", "project desc", "1"]
_ <- runTestCommand "git" ["checkout", "-b", "f/test"]
_ <- runTestCommand "touch" ["test"]
_ <- runTestCommand "git" ["add", "test"]
- _ <- runTestCommand "git" ["commit", "--message", "first commit"]
- commitSha <- runTestCommand "git" ["rev-parse", "--short", "HEAD"]
+ runTestCommand "git" ["commit", "--message", "first commit"]
+
+test_patch_propose :: TestTree
+test_patch_propose = testCaseSteps "patch propose" $ \step -> do
+ initProjectWithCommit
step "rad patch propose"
+ commitSha <- runTestCommand "git" ["rev-parse", "--short", "HEAD"]
_ <- runTestCommand "rad-patch" ["propose", "HEAD"]
listOutput <- runTestCommand "rad-patch" ["list"]
@@ -30,6 +34,13 @@ test_patch_propose = testCaseSteps "patch propose" $ \step -> do
assertContains showOutput $ "From " <> commitSha
assertContains showOutput "Comments\n---"
+test_patch_accept :: TestTree
+test_patch_accept = testCaseSteps "patch accept" $ \step -> do
+ initProjectWithCommit
+
+ step "rad patch propose"
+ _ <- runTestCommand "rad-patch" ["propose", "HEAD"]
+
step "rad patch accept"
_ <- runTestCommand "git" ["checkout", "master"]
_ <- runTestCommand "rad-patch" ["accept", "0"]