Skip to content

Commit

Permalink
4: update programs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillerv committed Dec 11, 2022
1 parent 26fafa1 commit 99dbace
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions content/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ func (p *Program) GetMedia() Media {
func (p *Program) mediaFactory() Media {
m := MediaTypeMap[p.Type]
switch m.(type) {
case *Announcement:
panic("implement me")
case *Folder:
folder := m.(*Folder)
folder.Name = p.Name
Expand All @@ -38,6 +36,7 @@ func (p *Program) mediaFactory() Media {
podcast := m.(*Podcast)
podcast.Name = p.Name
podcast.URL = p.Source
podcast.PlayOrder = "newest" // TODO: Add support for random, oldest, and set from PlayOrder from config.
log.Debugf("returning podcast: %v", formatter.StructToString(podcast))
return podcast
case *WebRadio:
Expand Down
15 changes: 15 additions & 0 deletions content/program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ func TestProgram_GetMedia(t *testing.T) {
Type: "file",
}).GetMedia(),
},
{
name: "Success: returns podcast",
fields: fields{
program: &Program{
Name: "Tech Won't Save Us",
Source: "https://feeds.buzzsprout.com/1004689.rss",
Timeslot: &Timeslot{
Begin: "11:00PM",
End: "11:30PM",
},
Type: "podcast",
},
},
want: nil,
},
{
name: "Success: returns web radio",
fields: fields{
Expand Down

0 comments on commit 99dbace

Please sign in to comment.