-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6efb65
commit 82d5deb
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package spec | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestCreateSpecFromVariables(t *testing.T) { | ||
t.Run("Valid Inputs", func(t *testing.T) { | ||
spec, err := CreateSpecFromBuildNameAndNumber("Common-builds", "1.2.0") | ||
|
||
assert.NoError(t, err) | ||
assert.NotNil(t, spec) | ||
assert.Equal(t, "Common-builds/1.2.0", spec.Files[0].Build) | ||
}) | ||
|
||
t.Run("Missing Build Name", func(t *testing.T) { | ||
spec, err := CreateSpecFromBuildNameAndNumber("", "1.2.0") | ||
|
||
assert.Error(t, err) | ||
assert.Nil(t, spec) | ||
assert.EqualError(t, err, "build name and build number must be provided") | ||
}) | ||
|
||
t.Run("Missing Build Number", func(t *testing.T) { | ||
spec, err := CreateSpecFromBuildNameAndNumber("Common-builds", "") | ||
|
||
assert.Error(t, err) | ||
assert.Nil(t, spec) | ||
assert.EqualError(t, err, "build name and build number must be provided") | ||
}) | ||
|
||
t.Run("Empty Build Name and Build Number", func(t *testing.T) { | ||
spec, err := CreateSpecFromBuildNameAndNumber("", "") | ||
|
||
assert.Error(t, err) | ||
assert.Nil(t, spec) | ||
assert.EqualError(t, err, "build name and build number must be provided") | ||
}) | ||
} |