summaryrefslogtreecommitdiff
path: root/test/rssignores.cpp
blob: 55368e04baf2d62d06c442b7eec92f2131722ce3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "rssignores.h"

#include "3rd-party/catch.hpp"

using namespace newsboat;

TEST_CASE(
	"RssIgnores::matches_lastmodified() returns true if given url "
	"has to always be downloaded",
	"[rss]")
{
	RssIgnores ignores;
	ignores.handle_action("always-download",
		{"http://newsboat.org",
			"www.cool-website.com",
			"www.example.com"});

	REQUIRE(ignores.matches_lastmodified("www.example.com"));
	REQUIRE(ignores.matches_lastmodified("http://newsboat.org"));
	REQUIRE(ignores.matches_lastmodified("www.cool-website.com"));
	REQUIRE_FALSE(ignores.matches_lastmodified("www.smth.com"));
}

TEST_CASE(
	"RssIgnores::matches_resetunread() returns true if given url "
	"will always have its unread flag reset on update",
	"[rss]")
{
	RssIgnores ignores;
	ignores.handle_action("reset-unread-on-update",
		{"http://newsboat.org",
			"www.cool-website.com",
			"www.example.com"});

	REQUIRE(ignores.matches_resetunread("www.example.com"));
	REQUIRE(ignores.matches_resetunread("http://newsboat.org"));
	REQUIRE(ignores.matches_resetunread("www.cool-website.com"));
	REQUIRE_FALSE(ignores.matches_resetunread("www.smth.com"));
}