2018-09-25 16:28:26 +00:00
|
|
|
import { findAll, visit } from '@ember/test-helpers';
|
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupApplicationTest } from 'ember-qunit';
|
|
|
|
import authPage from 'vault/tests/pages/auth';
|
|
|
|
import logout from 'vault/tests/pages/logout';
|
2018-04-03 14:16:57 +00:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
|
|
|
let adapterException;
|
|
|
|
let loggerError;
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
module('Acceptance | not-found', function(hooks) {
|
|
|
|
setupApplicationTest(hooks);
|
|
|
|
|
|
|
|
hooks.beforeEach(function() {
|
2018-04-03 14:16:57 +00:00
|
|
|
loggerError = Ember.Logger.error;
|
|
|
|
adapterException = Ember.Test.adapter.exception;
|
|
|
|
Ember.Test.adapter.exception = () => {};
|
|
|
|
Ember.Logger.error = () => {};
|
2018-09-25 16:28:26 +00:00
|
|
|
return authPage.login();
|
|
|
|
});
|
|
|
|
|
|
|
|
hooks.afterEach(function() {
|
2018-04-03 14:16:57 +00:00
|
|
|
Ember.Test.adapter.exception = adapterException;
|
|
|
|
Ember.Logger.error = loggerError;
|
2018-09-25 16:28:26 +00:00
|
|
|
return logout.visit();
|
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
test('top-level not-found', async function(assert) {
|
|
|
|
await visit('/404');
|
|
|
|
assert.ok(findAll('[data-test-not-found]').length, 'renders the not found component');
|
|
|
|
assert.ok(
|
|
|
|
findAll('[data-test-header-without-nav]').length,
|
|
|
|
'renders the not found component with a header'
|
|
|
|
);
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
test('vault route not-found', async function(assert) {
|
|
|
|
await visit('/vault/404');
|
2018-04-27 16:33:19 +00:00
|
|
|
assert.dom('[data-test-not-found]').exists('renders the not found component');
|
2018-09-25 16:28:26 +00:00
|
|
|
assert.ok(findAll('[data-test-header-with-nav]').length, 'renders header with nav');
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
test('cluster route not-found', async function(assert) {
|
|
|
|
await visit('/vault/secrets/secret/404/show');
|
2018-04-27 16:33:19 +00:00
|
|
|
assert.dom('[data-test-not-found]').exists('renders the not found component');
|
2018-09-25 16:28:26 +00:00
|
|
|
assert.ok(findAll('[data-test-header-with-nav]').length, 'renders header with nav');
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
test('secret not-found', async function(assert) {
|
|
|
|
await visit('/vault/secrets/secret/show/404');
|
2018-04-27 16:33:19 +00:00
|
|
|
assert.dom('[data-test-secret-not-found]').exists('renders the message about the secret not being found');
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
});
|