From 50ceb8413032223e20e34203c229c43d6c437e1b Mon Sep 17 00:00:00 2001 From: Zaq? Wiedmann Date: Fri, 15 Dec 2017 01:40:11 -0800 Subject: [PATCH] (tests) test passthrough to git and combined help text on `lab` --- cmd/root_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cmd/root_test.go b/cmd/root_test.go index 9c15ebba..2fe339dd 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -11,6 +11,7 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/zaquestion/lab/internal/git" ) @@ -64,3 +65,22 @@ func TestRootCloneNoArg(t *testing.T) { b, _ := cmd.CombinedOutput() require.Contains(t, string(b), "You must specify a repository to clone.") } + +func TestRootGitCmd(t *testing.T) { + cmd := exec.Command("../lab_bin", "log", "-n", "1") + b, _ := cmd.CombinedOutput() + require.Contains(t, string(b), `commit cd64a7caea4f3ee5696a190379aff1a7f636e598 +Author: Zaq? Wiedmann +Date: Sat Sep 2 20:58:39 2017 -0700 + + Added additional commit for LastCommitMessage and meeting requirements for Log test (>1 commit)`) +} + +func TestRootNoArg(t *testing.T) { + cmd := exec.Command("../lab_bin") + b, _ := cmd.CombinedOutput() + assert.Contains(t, string(b), "usage: git [--version] [--help] [-C ] [-c name=value]") + assert.Contains(t, string(b), `These GitLab commands are provided by lab: + + fork Fork a remote repository on GitLab and add as remote`) +}