Fix search saving, and add some unit tests
Also: - Return an object from `Zotero.Search.prototype.getConditions()` instead of an array. - Add support function `getPromiseError(promise)` to return the error thrown from a chain of promises, or false if none. (We could make an `assert.throwsAsync()`, but this allows testing of various properties such as `.name`, which even the built-in `assert.throws()` can't test.) - Clarify some search save errors
This commit is contained in:
parent
59773f3f6d
commit
d9c32a8e90
4 changed files with 68 additions and 9 deletions
|
@ -114,6 +114,13 @@ function waitForCallback(cb, interval, timeout) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a promise for the error thrown by a promise, or false if none
|
||||
*/
|
||||
function getPromiseError(promise) {
|
||||
return promise.thenReturn(false).catch(e => e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the PDF tools are installed, or installs them if not.
|
||||
* Returns a promise.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue