export default { props: { thePromise: new Promise(_ => {}) }, html: ` loading... `, async test({ assert, component, target }) { await (component.thePromise = Promise.resolve({ error: 'error message' })); assert.htmlEqual( target.innerHTML, `
error: error message
result: undefined
` ); await (component.thePromise = Promise.resolve({ result: '42' })); assert.htmlEqual( target.innerHTML, `error: undefined
result: 42
` ); try { await (component.thePromise = Promise.reject({ error: { message: 'oops', code: '123' } })); } catch (e) { // do nothing } assert.htmlEqual( target.innerHTML, `message: oops
code: 123
` ); try { await (component.thePromise = Promise.reject({ error: { message: 'timeout', code: '456' } })); } catch (e) { // do nothing } assert.htmlEqual( target.innerHTML, `message: timeout
code: 456
` ); } };