open-nomad/ui/tests/acceptance/global-header-test.js

50 lines
1.5 KiB
JavaScript
Raw Normal View History

/* eslint-disable ember-a11y-testing/a11y-audit-called */
import { module, test } from 'qunit';
import { visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupMirage } from 'ember-cli-mirage/test-support';
import Layout from 'nomad-ui/tests/pages/layout';
2021-12-28 14:45:20 +00:00
module('Acceptance | global header', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
2021-12-28 14:45:20 +00:00
test('it diplays no links', async function (assert) {
server.create('agent');
await visit('/');
assert.false(Layout.navbar.end.vaultLink.isVisible);
assert.false(Layout.navbar.end.vaultLink.isVisible);
});
2021-12-28 14:45:20 +00:00
test('it diplays both links', async function (assert) {
server.create('agent', 'withConsulLink', 'withVaultLink');
await visit('/');
assert.true(Layout.navbar.end.vaultLink.isVisible);
assert.true(Layout.navbar.end.vaultLink.isVisible);
});
2021-12-28 14:45:20 +00:00
test('it diplays Consul link', async function (assert) {
server.create('agent', 'withConsulLink');
await visit('/');
assert.true(Layout.navbar.end.consulLink.isVisible);
assert.equal(Layout.navbar.end.consulLink.text, 'Consul');
assert.equal(Layout.navbar.end.consulLink.link, 'http://localhost:8500/ui');
});
2021-12-28 14:45:20 +00:00
test('it diplays Vault link', async function (assert) {
server.create('agent', 'withVaultLink');
await visit('/');
assert.true(Layout.navbar.end.vaultLink.isVisible);
assert.equal(Layout.navbar.end.vaultLink.text, 'Vault');
assert.equal(Layout.navbar.end.vaultLink.link, 'http://localhost:8200/ui');
});
});