27bb03bbc0
* adding copyright header * fix fmt and a test
59 lines
1.5 KiB
JavaScript
59 lines
1.5 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import { resolve } from 'rsvp';
|
|
import EmberObject from '@ember/object';
|
|
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render, settled } from '@ember/test-helpers';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import sinon from 'sinon';
|
|
import { create } from 'ember-cli-page-object';
|
|
import authConfigForm from 'vault/tests/pages/components/auth-config-form/options';
|
|
|
|
const component = create(authConfigForm);
|
|
|
|
module('Integration | Component | auth-config-form options', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.owner.lookup('service:flash-messages').registerTypes(['success']);
|
|
this.router = this.owner.lookup('service:router');
|
|
this.router.reopen({
|
|
transitionTo() {
|
|
return {
|
|
followRedirects() {
|
|
return resolve();
|
|
},
|
|
};
|
|
},
|
|
replaceWith() {
|
|
return resolve();
|
|
},
|
|
});
|
|
});
|
|
|
|
test('it submits data correctly', async function (assert) {
|
|
assert.expect(1);
|
|
const model = EmberObject.create({
|
|
tune() {
|
|
return resolve();
|
|
},
|
|
config: {
|
|
serialize() {
|
|
return {};
|
|
},
|
|
},
|
|
});
|
|
sinon.spy(model.config, 'serialize');
|
|
this.set('model', model);
|
|
await render(hbs`{{auth-config-form/options model=this.model}}`);
|
|
component.save();
|
|
return settled().then(() => {
|
|
assert.ok(model.config.serialize.calledOnce);
|
|
});
|
|
});
|
|
});
|