let fulfil;
let thePromise = new Promise(f => {
fulfil = f;
});
export default {
props: {
thePromise
},
html: `
the promise is pending
`, async test({ assert, component, target }) { fulfil(); await thePromise; assert.htmlEqual(target.innerHTML, `the promise is resolved
the promise is resolved
the promise is resolved
`); let reject; thePromise = new Promise((f, r) => { reject = r; }); component.thePromise = thePromise; assert.htmlEqual(target.innerHTML, `the promise is pending
`); reject(new Error('something broke')); await thePromise.catch(() => {}); assert.htmlEqual(target.innerHTML, `oh no! something broke