Commit feff02a8 authored by Robert Knight's avatar Robert Knight

Add missing `return` to async test

Rewrite an async test to use async/await syntax for readability and add
a missing `return` so that mocha correctly waits for the test to finish
before continuing.
parent 39a806fc
...@@ -446,23 +446,15 @@ describe('HTML anchoring', function () { ...@@ -446,23 +446,15 @@ describe('HTML anchoring', function () {
frame.contentWindow.document.documentElement.innerHTML = fixtureHtml; frame.contentWindow.document.documentElement.innerHTML = fixtureHtml;
const annotationsChecked = annotations.map(function (ann) { const annotationsChecked = annotations.map(async ann => {
// Anchor the existing selectors
const root = frame.contentWindow.document.body; const root = frame.contentWindow.document.body;
const selectors = ann.target[0].selector; const selectors = ann.target[0].selector;
const result = html.anchor(root, selectors); const range = await html.anchor(root, selectors);
return result const newSelectors = await html.describe(root, range);
.then(function (range) { assert.deepEqual(sortByType(selectors), sortByType(newSelectors));
// Re-anchor the selectors and check that the new and existing
// selectors match.
return html.describe(root, range);
})
.then(function (newSelectors) {
assert.deepEqual(sortByType(selectors), sortByType(newSelectors));
});
}); });
Promise.all(annotationsChecked); return Promise.all(annotationsChecked);
}); });
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment