mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-08 03:31:59 +02:00
26 lines
577 B
Go
26 lines
577 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, "http://json-schema.org/draft-04/schema#", schema["$schema"].(string))
|
||
|
}
|