open-vault/ui/tests/integration/components/replication-page-test.js
Noelle Daley 032ffcaff2
Ui/fix ui tests (#9438)
* fix linting errors

* don't show primary url if we don't have any primaries

* Revert "fix linting errors"

This reverts commit a56d371272868d93024c557a6d5807be6eadda57.

* run all component tests always
2020-07-09 15:04:56 -07:00

39 lines
1.2 KiB
JavaScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
const MODEL = {
replicationMode: 'dr',
replicationAttrs: {
mode: 'secondary',
clusterId: '12ab',
replicationDisabled: false,
},
};
module('Integration | Component | replication-page', function(hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function() {
this.set('model', MODEL);
});
test('it renders', async function(assert) {
await render(hbs`<ReplicationPage @model={{model}} />`);
assert.dom('[data-test-replication-page]').exists();
assert.dom('[data-test-layout-loading]').doesNotExist();
});
test('it renders loader when either clusterId is unknown or mode is bootstrapping', async function(assert) {
this.set('model.replicationAttrs.clusterId', '');
await render(hbs`<ReplicationPage @model={{model}} />`);
assert.dom('[data-test-layout-loading]').exists();
this.set('model.replicationAttrs.clusterId', '123456');
this.set('model.replicationAttrs.mode', 'bootstrapping');
await render(hbs`<ReplicationPage @model={{model}} />`);
assert.dom('[data-test-layout-loading]').exists();
});
});