From 4e59ae43ceb2cfe76d673ccdd76ee0974019265d Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Mon, 28 Jun 2021 19:06:19 +0300 Subject: [PATCH] fixed tests --- pkg/git/repository_test.go | 42 +++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/pkg/git/repository_test.go b/pkg/git/repository_test.go index 5e1f7358..27767f24 100644 --- a/pkg/git/repository_test.go +++ b/pkg/git/repository_test.go @@ -720,34 +720,34 @@ func TestAddFlags(t *testing.T) { wantedFlags []flag }{ "Should create flags without a prefix": { - opts: &AddFlagsOptions{ - Optional: true, - }, + opts: &AddFlagsOptions{}, wantedFlags: []flag{ { name: "git-token", shorthand: "t", usage: "Your git provider api token [GIT_TOKEN]", + required: true, }, { - name: "repo", - usage: "Repository URL [GIT_REPO]", + name: "repo", + usage: "Repository URL [GIT_REPO]", + required: true, }, }, }, - "Should create flags with required": { - opts: &AddFlagsOptions{}, + "Should create flags with optional": { + opts: &AddFlagsOptions{ + Optional: true, + }, wantedFlags: []flag{ { name: "git-token", shorthand: "t", usage: "Your git provider api token [GIT_TOKEN]", - required: true, }, { - name: "repo", - usage: "Repository URL [GIT_REPO]", - required: true, + name: "repo", + usage: "Repository URL [GIT_REPO]", }, }, }, @@ -757,12 +757,14 @@ func TestAddFlags(t *testing.T) { }, wantedFlags: []flag{ { - name: "prefix-git-token", - usage: "Your git provider api token [PREFIX_GIT_TOKEN]", + name: "prefix-git-token", + usage: "Your git provider api token [PREFIX_GIT_TOKEN]", + required: true, }, { - name: "prefix-repo", - usage: "Repository URL [PREFIX_GIT_REPO]", + name: "prefix-repo", + usage: "Repository URL [PREFIX_GIT_REPO]", + required: true, }, }, }, @@ -772,12 +774,14 @@ func TestAddFlags(t *testing.T) { }, wantedFlags: []flag{ { - name: "prefix-git-token", - usage: "Your git provider api token [PREFIX_GIT_TOKEN]", + name: "prefix-git-token", + usage: "Your git provider api token [PREFIX_GIT_TOKEN]", + required: true, }, { - name: "prefix-repo", - usage: "Repository URL [PREFIX_GIT_REPO]", + name: "prefix-repo", + usage: "Repository URL [PREFIX_GIT_REPO]", + required: true, }, }, },