mirror of
https://github.com/zotero/zotero.git
synced 2026-10-10 03:28:10 +00:00
Restore timeout in dataObjectTest.js, fix test
OK, the timeout removed in 05e8da wasn't actually useless, but this test was. 41706a changed erase() so it no longer forwards skipNotifier when deleting child items. That means that we *would* get a notify() call for the deleted child, so the test should have been failing. However! Because of a bug in Bluebird's filtered catch() implementation, Promise.TimeoutError wasn't recognized as an Error subclass, and it was instead used as a predicate function, which would always pass. So all errors were caught as "timeouts" and suppressed, making this test always pass. Now it no longer always passes (but does pass with the current behavior).
This commit is contained in:
parent
6203b9712d
commit
97dbcc6870
1 changed files with 7 additions and 3 deletions
|
|
@ -379,8 +379,8 @@ describe("Zotero.DataObject", function () {
|
|||
promises.push(deferred.promise);
|
||||
observerIDs.push(Zotero.Notifier.registerObserver(
|
||||
{
|
||||
notify: function (event) {
|
||||
if (event == 'delete') {
|
||||
notify: function (event, type, ids) {
|
||||
if (event == 'delete' && ids.includes(obj.id)) {
|
||||
deferred.reject("Notifier called for erase on " + type);
|
||||
}
|
||||
}
|
||||
|
|
@ -392,7 +392,11 @@ describe("Zotero.DataObject", function () {
|
|||
skipNotifier: true
|
||||
});
|
||||
}
|
||||
await Promise.all(promises);
|
||||
await Promise.race([
|
||||
Promise.all(promises),
|
||||
// Give notifier time to trigger
|
||||
Zotero.Promise.delay(100),
|
||||
]);
|
||||
|
||||
for (let id of observerIDs) {
|
||||
Zotero.Notifier.unregisterObserver(id);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue