1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00
goreleaser/cmd/schema_test.go
Carlos A Becker 731f43b80e
test: fix test
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-08-04 15:37:19 -03:00

26 lines
582 B
Go

package cmd
import (
"encoding/json"
"os"
"path"
"testing"
"github.com/stretchr/testify/require"
)
func TestGenerateSchema(t *testing.T) {
cmd := newSchemaCmd().cmd
dir := t.TempDir()
destination := path.Join(dir, "schema.json")
cmd.SetArgs([]string{"--output", destination})
require.NoError(t, cmd.Execute())
outFile, err := os.Open(destination)
require.NoError(t, err)
schema := map[string]interface{}{}
require.NoError(t, json.NewDecoder(outFile).Decode(&schema))
require.Equal(t, "https://json-schema.org/draft/2020-12/schema", schema["$schema"].(string))
}