Merge branch 'main' into chore-unknown-type

This commit is contained in:
Carlos Alcaide Corvo authored and GitHub committed 2022-01-27 12:59:00 -06:00
commit 10806da5c2
9 files changed
+338 -9

No files matched your search

@@ -129,4 +129,84 @@ module('Unit | Model | host set', function (hooks) {
const model = store.peekRecord('host-set', '123abc');
await model.removeHost('3');
});
test('it has isStatic and returns the expected values', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('host-set', { type: 'static' });
const modelB = store.createRecord('host-set', { type: 'plugin' });
assert.equal(typeof modelA.isStatic, 'boolean');
assert.true(modelA.isStatic);
assert.false(modelB.isStatic);
});
test('it has isPlugin and returns the expected values', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const modelPlugin = store.createRecord('host-set', { type: 'plugin' });
const modelStatic = store.createRecord('host-set', { type: 'static' });
assert.equal(typeof modelPlugin.isPlugin, 'boolean');
assert.true(modelPlugin.isPlugin);
assert.false(modelStatic.isPlugin);
});
test('it has isAws and return the expected values', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const modelAws = store.createRecord('host-set', {
type: 'plugin',
plugin: { name: 'aws' },
});
const modelRandom = store.createRecord('host-set', {
plugin: { name: 'random' },
});
assert.equal(typeof modelAws.isAWS, 'boolean');
assert.true(modelAws.isAWS);
assert.false(modelRandom.isAWS);
});
test('it has isAzure and return the expected values', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const modelAzure = store.createRecord('host-set', {
type: 'plugin',
plugin: { name: 'azure' },
});
const modelRandom = store.createRecord('host-set', {
plugin: { name: 'random' },
});
assert.equal(typeof modelAzure.isAzure, 'boolean');
assert.true(modelAzure.isAzure);
assert.false(modelRandom.isAzure);
});
test('get compositeType return expected values', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const modelPlugin = store.createRecord('host-set', {
type: 'plugin',
plugin: { name: 'Test name' },
});
const modelStatic = store.createRecord('host-set', {
type: 'static',
});
assert.equal(typeof modelPlugin.compositeType, 'string');
assert.equal(modelPlugin.compositeType, 'Test name');
assert.equal(modelStatic.compositeType, 'static');
});
test('set compositeType sets expected values', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
const modelPlugin = store.createRecord('host-set', {
compositeType: 'aws',
});
const modelStatic = store.createRecord('host-set', {
compositeType: 'static',
});
assert.equal(modelPlugin.type, 'plugin');
assert.equal(modelPlugin.plugin.name, 'aws');
assert.equal(modelStatic.type, 'static');
});
});