Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions internal/scaffold/changelog_json_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package scaffold

import (
"encoding/json"
"strings"
"testing"
)

func TestChangelogJSONLowercase(t *testing.T) {
c := &Config{ID: "io.x.y", Namespace: "y", AppVersion: "0.1.0", Description: "d",
Listing: Listing{Changelog: []ChangelogRel{{Version: "0.1.0", Notes: []string{"first"}}}}}
b, _ := json.Marshal(BuildMetadata(c))
s := string(b)
for _, k := range []string{`"version"`, `"notes"`} {
if !strings.Contains(s, k) {
t.Errorf("metadata changelog missing lowercase key %s", k)
}
}
for _, k := range []string{`"Version"`, `"Notes"`, `"Date"`} {
if strings.Contains(s, k) {
t.Errorf("metadata changelog has Go-cased key %s", k)
}
}
}
6 changes: 3 additions & 3 deletions internal/scaffold/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ type Vendor struct {

// ChangelogRel is one release's notes for the store page.
type ChangelogRel struct {
Version string `yaml:"version"`
Date string `yaml:"date"`
Notes []string `yaml:"notes"`
Version string `json:"version" yaml:"version"`
Date string `json:"date,omitempty" yaml:"date"`
Notes []string `json:"notes,omitempty" yaml:"notes"`
}

// Publisher carries the path to the ed25519 signing key (generated once via
Expand Down
Loading