a. The test loops through each feed in the allFeeds
object and ensures it has a URL and name defined and that the URL and name is not empty, by using the $.forEach()
inside the it
.
b. Test suite "The menu"
- Test that ensures the menu element is hidden by default is done by checking the
.menu-hidden
class on thebody
tag. - Test that ensures the menu changes visibility when the menu icon is clicked is done by triggering the
click
event for themenu-icon-link
and checking formenu-hidden
class on thebody
tag.
c. Test suite "Initial Entries"
Test that ensures when the loadFeed
function is called and completes its work, there is at least a single .entry
element within the .feed
container.
loadFeed
requires anid
parameter andbeforeEach
cannot be inside a loop thereforeid
is incremented inside eachit
to allow the next feed to be loaded- on ajax success the feed's first entry is stored in
feedEntry.h2
- on ajax failure 'feedEntry.h2' will contain
Not Found
- it is expected that
feedEntry.count
not toEqual '0' andfeedEntry.h2
not toEqualNot Found
d. Test suite "New Feed Selection"
- this test is based on two nested
loadFeed
functions that mimic a click event - the first
loadFeed
is called withid = 0
inbeforeEach
and the.entry h2
is stored infeedEntry0
, - $.empty() is called to ensure clean container for the next load
- the second
loadFeed
withid = 1
is called inside thecb
function of the firstloadFeed
and the.entry h2
is stored infeedEntry1
- it is expected that
feedEntry0
is not toEqualfeedEntry1