feat: 🎸 create Host Modal for connecting to specific modal (#1898)
✅ Closes: ICU-10432
This commit is contained in:
1 parent
02ce3341bd
commit
c5cffd5137
9 files changed
+285
-3
No files matched your search
@@ -5,6 +5,7 @@
|
||||
|
||||
import GeneratedHostModel from '../generated/models/host';
|
||||
import { attr } from '@ember-data/model';
|
||||
import { pluginTypes } from './host-catalog';
|
||||
|
||||
export default class HostModel extends GeneratedHostModel {
|
||||
// =attributes
|
||||
@@ -58,6 +59,14 @@ export default class HostModel extends GeneratedHostModel {
|
||||
return this.type === 'plugin';
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the host catalog is an unknown type.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isUnknown() {
|
||||
return this.isPlugin && !pluginTypes.includes(this.plugin?.name);
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the host plugin type is AWS.
|
||||
* @type {boolean}
|
||||
|
||||
@@ -48,6 +48,28 @@ module('Unit | Model | host', function (hooks) {
|
||||
assert.false(modelStatic.isPlugin);
|
||||
});
|
||||
|
||||
test('it has isUnknown and returns the expected values', async function (assert) {
|
||||
assert.expect(4);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const modelAws = store.createRecord('host', {
|
||||
type: 'plugin',
|
||||
plugin: { name: 'aws' },
|
||||
});
|
||||
const modelAzure = store.createRecord('host', {
|
||||
type: 'plugin',
|
||||
plugin: { name: 'azure' },
|
||||
});
|
||||
const modelRandom = store.createRecord('host', {
|
||||
type: 'plugin',
|
||||
plugin: { name: 'random' },
|
||||
});
|
||||
|
||||
assert.strictEqual(typeof modelRandom.isUnknown, 'boolean');
|
||||
assert.true(modelRandom.isUnknown);
|
||||
assert.false(modelAws.isUnknown);
|
||||
assert.false(modelAzure.isUnknown);
|
||||
});
|
||||
|
||||
test('it has isAWS and returns the expected values', async function (assert) {
|
||||
assert.expect(3);
|
||||
const store = this.owner.lookup('service:store');
|
||||
|
||||
Reference in new issue
Block a user