generated from CodeYourFuture/tv-show-dom-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchUtils.test.js
37 lines (33 loc) · 1.46 KB
/
searchUtils.test.js
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
function matchesSearchFilter(episode, searchString) {
return true; // Will swap for other buggy implementations
}
// matchesSearchFilter (episode, filterString)
// should return true if the summary or name contains the filterString
// WRITE TESTS LIKE THIS
test ("test for matchesSearchFilter", function () {
let episode = {
id: 4952,
url: "http://www.tvmaze.com/episodes/4952/game-of-thrones-1x01-winter-is-coming",
name: "Winter is Coming",
season: 1,
number: 1,
airdate: "2011-04-17",
airtime: "21:00",
airstamp: "2011-04-18T01:00:00+00:00",
runtime: 60,
image: {
medium:
"http://static.tvmaze.com/uploads/images/medium_landscape/1/2668.jpg",
original:
"http://static.tvmaze.com/uploads/images/original_untouched/1/2668.jpg",
},
summary:
"<p>Lord Eddard Stark, ruler of the North, is summoned to court by his old friend, King Robert Baratheon, to serve as the King's Hand. Eddard reluctantly agrees after learning of a possible threat to the King's life. Eddard's bastard son Jon Snow must make a painful decision about his own future, while in the distant east Viserys Targaryen plots to reclaim his father's throne, usurped by Robert, by selling his sister in marriage.</p>",
_links: {
self: {
href: "http://api.tvmaze.com/episodes/4952",
},
},
};
expect(matchesSearchFilter(episode, "Winter")).toBe(true);
} );