Skip to content

Commit

Permalink
Simplify delayed assertion on encodings
Browse files Browse the repository at this point in the history
We can rely on `done()` not being called to report test as failed.
  • Loading branch information
carhartl committed Jun 21, 2023
1 parent f79ea75 commit 246e335
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions test/utils.js
@@ -1,4 +1,4 @@
/* global Cookies, QUnit */
/* global Cookies */
/* eslint-disable no-var */

;(function () {
Expand Down Expand Up @@ -48,24 +48,13 @@
var done = assert.async()
iframe.addEventListener('load', function () {
var iframeDocument = iframe.contentWindow.document
var root = iframeDocument.documentElement
var content = root.textContent
if (!content) {
QUnit.ok(
false,
['"' + requestURL + '"', 'content should not be empty'].join(
' '
)
)
done()
return
}
try {
var result = JSON.parse(content)
var result = JSON.parse(
iframeDocument.documentElement.textContent
)
callback(result.value, iframeDocument.cookie)
} finally {
done()
}
} catch (e) {}
})
iframe.src = requestURL
}
Expand Down

0 comments on commit 246e335

Please sign in to comment.