aboutsummaryrefslogtreecommitdiff
path: root/internal/reader/processor/processor_test.go
diff options
context:
space:
mode:
authorGravatar Jean Khawand <22157081+jeankhawand@users.noreply.github.com> 2024-03-20 03:58:53 +0100
committerGravatar GitHub <noreply@github.com> 2024-03-20 02:58:53 +0000
commita78d1c79da81dcf2a40d65b0a41d8164e5b4f6b1 (patch)
tree6b554752d83eda5820d22823e9704af0e89054ac /internal/reader/processor/processor_test.go
parent1ea3953271209cf7a26d549f0c41c64506976bab (diff)
downloadv2-a78d1c79da81dcf2a40d65b0a41d8164e5b4f6b1.tar.gz
v2-a78d1c79da81dcf2a40d65b0a41d8164e5b4f6b1.tar.zst
v2-a78d1c79da81dcf2a40d65b0a41d8164e5b4f6b1.zip
Add `FILTER_ENTRY_MAX_AGE_DAYS` config option to limit fetching all feed items
Diffstat (limited to 'internal/reader/processor/processor_test.go')
-rw-r--r--internal/reader/processor/processor_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/reader/processor/processor_test.go b/internal/reader/processor/processor_test.go
index a0d5f6f5..e99a566a 100644
--- a/internal/reader/processor/processor_test.go
+++ b/internal/reader/processor/processor_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"time"
+ "miniflux.app/v2/internal/config"
"miniflux.app/v2/internal/model"
)
@@ -92,3 +93,27 @@ func TestParseISO8601(t *testing.T) {
}
}
}
+
+func TestIsRecentEntry(t *testing.T) {
+ parser := config.NewParser()
+ var err error
+ config.Opts, err = parser.ParseEnvironmentVariables()
+ if err != nil {
+ t.Fatalf(`Parsing failure: %v`, err)
+ }
+ var scenarios = []struct {
+ entry *model.Entry
+ expected bool
+ }{
+ {&model.Entry{Title: "Example1", Date: time.Date(2005, 5, 1, 05, 05, 05, 05, time.UTC)}, true},
+ {&model.Entry{Title: "Example2", Date: time.Date(2010, 5, 1, 05, 05, 05, 05, time.UTC)}, true},
+ {&model.Entry{Title: "Example3", Date: time.Date(2020, 5, 1, 05, 05, 05, 05, time.UTC)}, true},
+ {&model.Entry{Title: "Example4", Date: time.Date(2024, 3, 15, 05, 05, 05, 05, time.UTC)}, true},
+ }
+ for _, tc := range scenarios {
+ result := isRecentEntry(tc.entry)
+ if tc.expected != result {
+ t.Errorf(`Unexpected result, got %v for entry %q`, result, tc.entry.Title)
+ }
+ }
+}