MCPcopy
hub / github.com/mxpv/podsync / TestBuildXML

Function TestBuildXML

pkg/feed/xml_test.go:13–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestBuildXML(t *testing.T) {
14 feed := model.Feed{
15 Episodes: []*model.Episode{
16 {
17 ID: "1",
18 Status: model.EpisodeDownloaded,
19 Title: "title",
20 Description: "description",
21 },
22 },
23 }
24
25 cfg := Config{
26 ID: "test",
27 Custom: Custom{Description: "description", Category: "Technology", Subcategories: []string{"Gadgets", "Podcasting"}},
28 }
29
30 out, err := Build(context.Background(), &feed, &cfg, "http://localhost/")
31 assert.NoError(t, err)
32
33 assert.EqualValues(t, "description", out.Description)
34 assert.EqualValues(t, "Technology", out.Category)
35
36 require.Len(t, out.ICategories, 1)
37 category := out.ICategories[0]
38 assert.EqualValues(t, "Technology", category.Text)
39
40 require.Len(t, category.ICategories, 2)
41 assert.EqualValues(t, "Gadgets", category.ICategories[0].Text)
42 assert.EqualValues(t, "Podcasting", category.ICategories[1].Text)
43
44 require.Len(t, out.Items, 1)
45 require.NotNil(t, out.Items[0].Enclosure)
46 assert.EqualValues(t, out.Items[0].Enclosure.URL, "http://localhost/test/1.mp4")
47 assert.EqualValues(t, out.Items[0].Enclosure.Type, itunes.MP4)
48}

Callers

nothing calls this directly

Calls 2

BuildFunction · 0.85
LenMethod · 0.80

Tested by

no test coverage detected