Fix some test breakages related to .note/.getNote() changes

This commit is contained in:
Dan Stillman 2020-12-27 23:41:12 -05:00
parent 9997ece0d2
commit 0fe6e3d055
2 changed files with 19 additions and 10 deletions

View file

@ -227,7 +227,7 @@ describe("Zotero.DataObject", function() {
var item = new Zotero.Item('book');
var id = yield item.saveTx();
yield item.loadAllData();
assert.throws(item.getNote.bind(item), 'note can only be called on notes and attachments');
assert.throws(item.getNote.bind(item), 'getNote() can only be called on notes and attachments');
})
it("should load data on an attachment item", function* () {

View file

@ -10,22 +10,31 @@ describe("Zotero.FeedItems", function () {
describe("#getMarkedAsRead", function() {
var items = [];
var result;
before(function* () {
before(async function () {
for (let i = 0; i < 4; i++) {
let f = yield createDataObject('feedItem', {libraryID: feed.libraryID, guid: 'http://www.example.com/' + i});
let f = await createDataObject(
'feedItem',
{
libraryID: feed.libraryID,
guid: 'http://www.example.com/' + i
}
);
items.push(f);
}
yield items[0].toggleRead();
yield items[2].toggleRead();
result = yield Zotero.FeedItems.getMarkedAsRead(feed.libraryID);
await items[0].toggleRead();
await items[2].toggleRead();
result = (await Zotero.FeedItems.getMarkedAsRead(feed.libraryID)).map(x => x.id);
});
it('should get all marked as read items', function() {
assert.include(result, items[0]);
assert.include(result, items[2]);
assert.include(result, items[0].id);
assert.include(result, items[2].id);
});
it('should not include items that were not marked', function() {
assert.notInclude(result, items[1]);
assert.notInclude(result, items[3]);
assert.notInclude(result, items[1].id);
assert.notInclude(result, items[3].id);
});
});