Skip to content

Commit

Permalink
(tests) test passthrough to git and combined help text on lab
Browse files Browse the repository at this point in the history
  • Loading branch information
zaquestion committed Dec 15, 2017
1 parent 5dd2085 commit 50ceb84
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zaquestion/lab/internal/git"
)
Expand Down Expand Up @@ -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 <zaquestion@gmail.com>
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 <path>] [-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`)
}

0 comments on commit 50ceb84

Please sign in to comment.