open-vault/ui/tests/integration/components/raft-join-test.js
Jordan Reimer 52fe56ec87
Eslint prefer-const (#17864)
* adds prefer-const to eslint config and runs fixer

* reverts unintended change
2022-11-09 15:15:31 -08:00

38 lines
1.3 KiB
JavaScript

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { click, render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import sinon from 'sinon';
module('Integration | Component | raft-join', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<RaftJoin />`);
assert.dom('[data-test-join-choice]').exists();
});
test('it shows the join form when clicking next', async function (assert) {
await render(hbs`<RaftJoin />`);
await click('[data-test-next]');
assert.dom('[data-test-join-header]').exists();
});
test('it returns to the first screen when clicking back', async function (assert) {
await render(hbs`<RaftJoin />`);
await click('[data-test-next]');
assert.dom('[data-test-join-header]').exists();
await click('[data-test-cancel-button]');
assert.dom('[data-test-join-choice]').exists();
});
test('it calls onDismiss when a user chooses to init', async function (assert) {
const spy = sinon.spy();
this.set('onDismiss', spy);
await render(hbs`<RaftJoin @onDismiss={{this.onDismiss}} />`);
await click('[data-test-join-init]');
await click('[data-test-next]');
assert.ok(spy.calledOnce, 'it calls the passed onDismiss');
});
});