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;
|
var opmlString;
|
||||||
|
|
||||||
before(function* (){
|
before(function* (){
|
||||||
opmlString = yield Zotero.File.getContentsFromURLAsync(opmlUrl)
|
opmlString = yield Zotero.File.getContentsFromURLAsync(opmlUrl);
|
||||||
|
sinon.stub(Zotero.Feeds, 'updateFeeds').resolves();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function* () {
|
beforeEach(function* () {
|
||||||
yield clearFeeds();
|
yield clearFeeds();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
after(function() {
|
||||||
|
Zotero.Feeds.updateFeeds.restore();
|
||||||
|
});
|
||||||
|
|
||||||
it('imports feeds correctly', function* (){
|
it('imports feeds correctly', function* (){
|
||||||
let shouldExist = {
|
let shouldExist = {
|
||||||
"http://example.com/feed1.rss": "A title 1",
|
"http://example.com/feed1.rss": "A title 1",
|
||||||
"http://example.com/feed2.rss": "A title 2",
|
"http://example.com/feed2.rss": "A title 2",
|
||||||
"http://example.com/feed3.rss": "A title 3",
|
"http://example.com/feed3.rss": "A title 3",
|
||||||
"http://example.com/feed4.rss": "A title 4"
|
"http://example.com/feed4.rss": "A title 4"
|
||||||
}; yield Zotero.Feeds.importFromOPML(opmlString);
|
};
|
||||||
|
yield Zotero.Feeds.importFromOPML(opmlString);
|
||||||
let feeds = Zotero.Feeds.getAll();
|
let feeds = Zotero.Feeds.getAll();
|
||||||
for (let feed of feeds) {
|
for (let feed of feeds) {
|
||||||
assert.equal(shouldExist[feed.url], feed.name, "Feed exists and title matches");
|
assert.equal(shouldExist[feed.url], feed.name, "Feed exists and title matches");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue