Created
June 5, 2017 10:48
-
-
Save piatra/de9e605daef1523c887ac625ca0cd950 to your computer and use it in GitHub Desktop.
places provider test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.test_Links_getBookmarks = function*(assert) { | |
let provider = PlacesProvider.links; | |
let bookmarks = [ | |
{url: "https://mozilla1.com/0", parentGuid: "root________", type: Bookmarks.TYPE_BOOKMARK}, | |
{url: "https://mozilla1.com/1", parentGuid: "root________", type: Bookmarks.TYPE_BOOKMARK} | |
]; | |
for (let placeInfo of bookmarks) { | |
yield Bookmarks.insert(placeInfo); | |
} | |
let bookmarksSize = yield provider.getBookmarksSize(); | |
assert.equal(bookmarksSize, 2, "size 2 for 2 bookmarks added"); | |
let { | |
TRANSITION_TYPED, | |
TRANSITION_LINK | |
} = PlacesUtils.history; | |
let visits = [ | |
{uri: NetUtil.newURI(bookmarks[0].url), visitDate: timeDaysAgo(1), transition: TRANSITION_TYPED}, | |
{uri: NetUtil.newURI(bookmarks[1].url), visitDate: timeDaysAgo(0), transition: TRANSITION_LINK} | |
]; | |
yield PlacesTestUtils.addVisits(visits); | |
let recentBookmarks = yield provider.getBookmarks(); | |
assert.equal(recentBookmarks.length, 2, "two recently added bookmarks"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment