mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
731f43b80e
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
26 lines
582 B
Go
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))
|
|
}
|