import { create_deferred } from '../../../helpers.js';
let deferred;
export default {
before_test() {
deferred = create_deferred();
},
get props() {
return { thePromise: deferred.promise };
},
html: `
the promise is pending
`, async test({ assert, component, target }) { deferred.resolve(42); await deferred.promise; assert.htmlEqual(target.innerHTML, 'the promise is pending
'); const rejection = deferred.promise .catch(() => {}) .finally(() => { assert.htmlEqual( target.innerHTML, `oh no! Something broke!
oh no! Something broke!
` ); }); deferred.reject(new Error()); await rejection; } };