Skip to content

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hashishaw committed Jun 5, 2024
1 parent 278d61d commit c724ec9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
29 changes: 28 additions & 1 deletion ui/tests/integration/components/form-field-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,41 @@ module('Integration | Component | form field', function (hooks) {
});

test('it renders: editType ttl', async function (assert) {
const [model, spy] = await setup.call(this, createAttr('foo', null, { editType: 'ttl' }));
const [model, spy] = await setup.call(
this,
createAttr('foo', null, {
editType: 'ttl',
helperTextDisabled: 'TTL is disabled',
helperTextEnabled: 'TTL is enabled',
})
);
assert.ok(component.hasTTLPicker, 'renders the ttl-picker component');
assert.dom('[data-test-ttl-form-subtext]').hasText('TTL is disabled');
assert.dom('[data-test-ttl-toggle]').isNotChecked();
await component.fields.objectAt(0).toggleTtl();
await component.fields.objectAt(0).select('h').change();
await component.fields.objectAt(0).ttlTime('3');
const expectedSeconds = `${3 * 3600}s`;
assert.strictEqual(model.get('foo'), expectedSeconds);
assert.ok(spy.calledWith('foo', expectedSeconds), 'onChange called with correct args');
await component.fields.objectAt(0).toggleTtl();
assert.ok(spy.calledWith('foo', '0'), 'onChange called with 0 when toggle off');
});

test('it renders: editType ttl with special settings', async function (assert) {
const [model, spy] = await setup.call(
this,
createAttr('foo', null, {
editType: 'ttl',
setDefault: '3600s',
ttlOffValue: '',
})
);
assert.ok(component.hasTTLPicker, 'renders the ttl-picker component');
assert.dom('[data-test-ttl-toggle]').isChecked();
await component.fields.objectAt(0).toggleTtl();
assert.strictEqual(model.get('foo'), '');
assert.ok(spy.calledWith('foo', ''), 'onChange called with correct args');
});

test('it renders: editType ttl without toggle', async function (assert) {
Expand Down
5 changes: 5 additions & 0 deletions ui/tests/unit/adapters/aws-credential-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ module('Unit | Adapter | aws credential', function (hooks) {
[storeStub, type, makeSnapshot({ credentialType: 'assumed_role' })],
'POST',
],
[
'assumed_role type no arn, ttl empty',
[storeStub, type, makeSnapshot({ credentialType: 'assumed_role', ttl: '' })],
'POST',
],
[
'assumed_role type no arn',
[storeStub, type, makeSnapshot({ credentialType: 'assumed_role', ttl: '3h' })],
Expand Down

0 comments on commit c724ec9

Please sign in to comment.