Skip to content

Commit

Permalink
remove testdata generation
Browse files Browse the repository at this point in the history
  • Loading branch information
mfridman committed Mar 22, 2024
1 parent 1c13d85 commit f9dc82d
Show file tree
Hide file tree
Showing 18 changed files with 1 addition and 4,281 deletions.
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ test: build $(BIN)/jv ## Run unit tests

.PHONY: golden
golden: generate
rm -rf internal/testdata/bigquery
rm -rf internal/testdata/pubsub
rm -rf internal/testdata/jsonschema
go run internal/cmd/bigquery-generate-testdata/main.go internal/testdata/bigquery
go run internal/cmd/pubsub-generate-testdata/main.go internal/testdata/pubsub
go run internal/cmd/jsonschema-generate-testdata/main.go internal/testdata/jsonschema
rm -rf ./internal/testdata/codegenrequest/input.json
buf build ./internal/proto --exclude-source-info -o -#format=json > ./internal/testdata/codegenrequest/input.json

.PHONY: build
Expand Down
125 changes: 0 additions & 125 deletions internal/cmd/bigquery-generate-testdata/main.go

This file was deleted.

73 changes: 0 additions & 73 deletions internal/cmd/jsonschema-generate-testdata/main.go

This file was deleted.

66 changes: 0 additions & 66 deletions internal/cmd/pubsub-generate-testdata/main.go

This file was deleted.

41 changes: 0 additions & 41 deletions internal/protoschema/bigquery/bigquery_test.go

This file was deleted.

23 changes: 0 additions & 23 deletions internal/protoschema/jsonschema/jsonschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,11 @@
package jsonschema

import (
"encoding/json"
"path/filepath"
"testing"

"github.com/bufbuild/protoschema-plugins/internal/protoschema/golden"
"github.com/stretchr/testify/require"
)

func TestJSONSchemaGolden(t *testing.T) {
t.Parallel()
dirPath := filepath.FromSlash("../../testdata/jsonschema")
for _, testDesc := range golden.GetTestDescriptors() {
for _, entry := range Generate(testDesc) {
// Serialize the JSON
data, err := json.MarshalIndent(entry, "", " ")
require.NoError(t, err)

identifier, ok := entry["$id"].(string)
require.True(t, ok)
require.NotEmpty(t, identifier)

filePath := filepath.Join(dirPath, identifier)
err = golden.CheckGolden(filePath, string(data)+"\n")
require.NoError(t, err)
}
}
}

func TestTitle(t *testing.T) {
t.Parallel()
require.Equal(t, "Foo", generateTitle("Foo"))
Expand Down
Loading

0 comments on commit f9dc82d

Please sign in to comment.