refactor: 💡 fix routing for static credentials from targets (#1347)

* refactor: 💡 fix routing for static credentials from targets

✅ Closes: ICU-6155

* chore: 🤖 Add comment to isStatic credential helper method
This commit is contained in:
Cameron Perera authored and GitHub committed 2022-09-21 15:10:28 -05:00
1 parent 9e55f5f157
commit e6d68c2e4a
4 files changed
+23 -12

No files matched your search

@@ -10,21 +10,27 @@ module('Unit | Model | credential', function (hooks) {
assert.ok(model);
});
test('it has isUsernamePassword property and returns the expected values', async function (assert) {
assert.expect(2);
test('it has isStatic 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' });
const modelA = store.createRecord('credential', { id: 'credup_123' });
const modelB = store.createRecord('credential', { id: 'credspk_123' });
const modelC = store.createRecord('credential', { id: 'notstatic_123' });
assert.true(modelA.isUsernamePassword);
assert.false(modelB.isUsernamePassword);
assert.true(modelA.isStatic);
assert.true(modelB.isStatic);
assert.false(modelC.isStatic);
});
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' });
const modelA = store.createRecord('credential', {
type: 'username_password',
});
const modelB = store.createRecord('credential', {
type: 'ssh_private_key',
});
const modelC = store.createRecord('credential', { type: 'unknown' });
assert.false(modelA.isUnknown);