Skip to content

Commit 5c73499

Browse files
committed
Add unit tests for issue #798
1 parent ed6a25f commit 5c73499

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

services/update/matcher_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package update
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
8+
"github.com/mxpv/podsync/pkg/feed"
9+
"github.com/mxpv/podsync/pkg/model"
10+
)
11+
12+
func TestNotTitleFilterIssue798(t *testing.T) {
13+
// https://github.com/mxpv/podsync/issues/798
14+
filters := &feed.Filters{
15+
NotTitle: "(?i)^(holy mass|holy sacrifice|the holy)( |$)",
16+
MinDuration: 600,
17+
}
18+
19+
// Titles starting with pattern should be excluded
20+
assert.False(t, matchFilters(&model.Episode{ID: "1", Title: "Holy Mass — Tuesday", Duration: 3600}, filters))
21+
assert.False(t, matchFilters(&model.Episode{ID: "2", Title: "The Holy Sacrifice of the Mass", Duration: 3600}, filters))
22+
assert.False(t, matchFilters(&model.Episode{ID: "3", Title: "The Holy Mass (Latin)", Duration: 3600}, filters))
23+
24+
// Titles NOT starting with pattern should be included
25+
assert.True(t, matchFilters(&model.Episode{ID: "4", Title: "Homily: The Parable of the Good Samaritan", Duration: 1200}, filters))
26+
assert.True(t, matchFilters(&model.Episode{ID: "5", Title: "Sermon — Love Your Enemies", Duration: 1800}, filters))
27+
assert.True(t, matchFilters(&model.Episode{ID: "6", Title: "Reflection on Today's Gospel", Duration: 900}, filters))
28+
}

0 commit comments

Comments
 (0)