This assert.asyncThrows
custom assertion allows us to write tests against failing async code, usually as a result of a server error (4xx/5xx response).
test('If the index route errors, I see a message', async function(assert) {
server.create('post');
server.get('/posts/:id', { errors: ['The site is down'] }, 500); // force Mirage to error
await assert.asyncThrows(() => {
return visit('/posts/1');
}, 'GET /posts/1 returned a 500');