Files
threshold-ui/addons/api/tests/unit/models/credential-test.js
T

56 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-07-19 13:02:04 -07:00
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
2022-07-28 17:49:51 -07:00
module('Unit | Model | credential', function (hooks) {
2022-07-19 13:02:04 -07:00
setupTest(hooks);
2022-07-28 17:49:51 -07:00
test('it exists', function (assert) {
const store = this.owner.lookup('service:store');
const model = store.createRecord('credential', {});
2022-07-19 13:02:04 -07:00
assert.ok(model);
});
2022-09-20 17:31:16 -07:00
test('it has isStatic property and returns the expected values', async function (assert) {
assert.expect(3);
2022-09-20 17:31:16 -07:00
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('credential', { id: 'credup_123' });
const modelB = store.createRecord('credential', { id: 'credspk_123' });
const modelC = store.createRecord('credential', { id: 'notstatic_123' });
2022-09-20 17:31:16 -07:00
assert.true(modelA.isStatic);
assert.true(modelB.isStatic);
assert.false(modelC.isStatic);
2022-09-20 17:31:16 -07:00
});
2022-12-16 15:06:19 -05:00
test('it has isJSON property and returns the expected values', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('credential', { type: 'json' });
const modelB = store.createRecord('credential', {
type: 'username_password',
});
const modelC = store.createRecord('credential', {
type: 'ssh_private_key',
});
assert.true(modelA.isJSON);
assert.false(modelB.isJSON);
assert.false(modelC.isJSON);
});
2022-09-20 17:31:16 -07:00
test('it has isUnknown property and returns the expected values', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('credential', {
type: 'username_password',
});
const modelB = store.createRecord('credential', {
type: 'ssh_private_key',
});
2022-09-20 17:31:16 -07:00
const modelC = store.createRecord('credential', { type: 'unknown' });
assert.false(modelA.isUnknown);
assert.false(modelB.isUnknown);
assert.true(modelC.isUnknown);
});
2022-07-19 13:02:04 -07:00
});