✨ Entry implements json.Marshaler
This commit is contained in:
parent
7e1c51d698
commit
f3bf89b09e
2 changed files with 22 additions and 2 deletions
|
|
@ -191,7 +191,7 @@ func TestScan(t *testing.T) {
|
|||
|
||||
func TestEntryJsonMarshal(t *testing.T) {
|
||||
when := time.Now()
|
||||
whens := when.Format(DateFormat)
|
||||
whens := when.Format(time.RFC3339)
|
||||
simple := []Meta{}
|
||||
tests := []struct {
|
||||
name string
|
||||
|
|
@ -210,6 +210,7 @@ func TestEntryJsonMarshal(t *testing.T) {
|
|||
{"empty-title", "", when, simple, "", ErrorMissingTitle},
|
||||
{"empty-date", "A Title", time.Time{}, simple, "", ErrorMissingDate},
|
||||
{"obj-field", "A Title", when, []Meta{{"obj", json.RawMessage(`{"foo":"bar","title":"Sub-title"}`)}}, `{"title":"A Title","date":"` + whens + `","obj":{"foo":"bar","title":"Sub-title"}}`, nil},
|
||||
{"date-field", "A Title", when, []Meta{{"when", when.Add(time.Hour)}}, `{"title":"A Title","date":"` + whens + `","when":"` + when.Add(time.Hour).Format(time.RFC3339) + `"}`, nil},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue