Stub out feed updates for importFromOPML() tests
No need to do network requests
This commit is contained in:
parent
0f45569ccd
commit
ddd1455aab
1 changed files with 8 additions and 2 deletions
|
@ -9,20 +9,26 @@ describe("Zotero.Feeds", function () {
|
|||
var opmlString;
|
||||
|
||||
before(function* (){
|
||||
opmlString = yield Zotero.File.getContentsFromURLAsync(opmlUrl)
|
||||
opmlString = yield Zotero.File.getContentsFromURLAsync(opmlUrl);
|
||||
sinon.stub(Zotero.Feeds, 'updateFeeds').resolves();
|
||||
});
|
||||
|
||||
beforeEach(function* () {
|
||||
yield clearFeeds();
|
||||
});
|
||||
|
||||
after(function() {
|
||||
Zotero.Feeds.updateFeeds.restore();
|
||||
});
|
||||
|
||||
it('imports feeds correctly', function* (){
|
||||
let shouldExist = {
|
||||
"http://example.com/feed1.rss": "A title 1",
|
||||
"http://example.com/feed2.rss": "A title 2",
|
||||
"http://example.com/feed3.rss": "A title 3",
|
||||
"http://example.com/feed4.rss": "A title 4"
|
||||
}; yield Zotero.Feeds.importFromOPML(opmlString);
|
||||
};
|
||||
yield Zotero.Feeds.importFromOPML(opmlString);
|
||||
let feeds = Zotero.Feeds.getAll();
|
||||
for (let feed of feeds) {
|
||||
assert.equal(shouldExist[feed.url], feed.name, "Feed exists and title matches");
|
||||
|
|
Loading…
Reference in a new issue