test: 💍 Credential library deletion error test

This commit is contained in:
dharini committed 2021-07-26 16:58:23 -07:00
1 parent be7e3bb56e
commit 025ae1bfe2
1 file changed
+19 -1
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
import { visit, click, find } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -93,4 +93,22 @@ module('Acceptance | credential-library', function (hooks) {
assert.equal(getCredentialLibraryCount(), count);
assert.ok(confirmService.confirm.calledOnce);
});
test('deleting a credential library which errors displays error messages', async function (assert) {
assert.expect(1);
this.server.del('/credential-libraries/:id', () => {
return new Response(
490,
{},
{
status: 490,
code: 'error',
message: 'Oops.',
}
);
});
await visit(urls.credentialLibrary);
await click('.rose-layout-page-actions .rose-dropdown-button-danger');
assert.ok(find('[role="alert"]').textContent.trim(), 'Oops.');
});
});