Skip to content

Commit

Permalink
test: cover artifact.Type.String() with tests
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
  • Loading branch information
caarlos0 committed Nov 28, 2020
1 parent 4233bd9 commit 47ff5a4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions internal/artifact/artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,28 @@ func TestByFormats(t *testing.T) {
require.Len(t, artifacts.Filter(ByFormats("zip")).items, 2)
require.Len(t, artifacts.Filter(ByFormats("zip", "tar.gz")).items, 3)
}

func TestTypeToString(t *testing.T) {
for _, a := range []Type{
UploadableArchive,
UploadableBinary,
UploadableFile,
Binary,
LinuxPackage,
PublishableSnapcraft,
Snapcraft,
PublishableDockerImage,
DockerImage,
DockerManifest,
Checksum,
Signature,
UploadableSourceArchive,
} {
t.Run(a.String(), func(t *testing.T) {
require.NotEqual(t, "unknown", a.String())
})
}
t.Run("unknown", func(t *testing.T) {
require.Equal(t, "unknown", Type(9999).String())
})
}

0 comments on commit 47ff5a4

Please sign in to comment.