export default {
props: {
thePromise: new Promise((_) => {})
},
html: `
error: undefined
`,
async test({ assert, component, target }) {
await (component.thePromise = Promise.resolve('abc'));
assert.htmlEqual(
target.innerHTML,
`
error: undefined
After Resolve: undefined
`
);
component.error = 'external error occurred';
assert.htmlEqual(
target.innerHTML,
`
error: ${component.error}
After Resolve: ${component.error}
`
);
try {
await (component.thePromise = Promise.reject('failure'));
} catch (error) {
// ignore
}
assert.htmlEqual(
target.innerHTML,
`
error: ${component.error}
Rejected: failure
`
);
}
};