Skip to content

Commit

Permalink
mmcdole#151: To make the test work, the parsed extensions have to tak…
Browse files Browse the repository at this point in the history
…e a json roundtrip
  • Loading branch information
Necoro committed Mar 5, 2023
1 parent 5251f76 commit 9eb41f5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rss/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ func TestParser_Parse(t *testing.T) {
fp := &rss.Parser{}
actual, _ := fp.Parse(bytes.NewReader(f), gofeed.NewParser().BuildRSSExtParsers())

// the `Parsed` part of extensions is not correctly unmarshalled from JSON
// workaround: move the actual extensions through a round of json marshalling so that we get the same
for _, i := range actual.Items {
if len(i.Extensions) > 0 {
b, _ := json.Marshal(i.Extensions)
json.Unmarshal(b, &i.Extensions)
}
}

// Get json encoded expected feed result
ef := fmt.Sprintf("../testdata/parser/rss/%s.json", name)
e, _ := ioutil.ReadFile(ef)
Expand Down

0 comments on commit 9eb41f5

Please sign in to comment.