feat: 🎸 Add new fields to host
Add new fields to host and refactor field address to use no more fragment-host-attribute-model
This commit is contained in:
1 parent
6f8d424bed
commit
f8c4eb470f
5 files changed
+73
-27
No files matched your search
@@ -4,19 +4,48 @@ import { setupTest } from 'ember-qunit';
|
||||
module('Unit | Serializer | host', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let serializer = store.serializerFor('host');
|
||||
|
||||
assert.ok(serializer);
|
||||
test('it serializes host with type static as expected', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const record = store.createRecord('host', {
|
||||
name: 'Host 1',
|
||||
compositeType: 'static',
|
||||
description: 'Description',
|
||||
host_catalog_id: '123',
|
||||
version: 1,
|
||||
address: '188e:68a9:b342:c05c:2595:2f46:499c:759f',
|
||||
});
|
||||
assert.deepEqual(record.serialize(), {
|
||||
name: 'Host 1',
|
||||
description: 'Description',
|
||||
type: 'static',
|
||||
host_catalog_id: '123',
|
||||
version: 1,
|
||||
attributes: {
|
||||
address: '188e:68a9:b342:c05c:2595:2f46:499c:759f',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('it serializes records', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('host', {});
|
||||
test('it serializes host with type plugin as expected', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const recordAws = store.createRecord('host', {
|
||||
name: 'Host 2',
|
||||
description: 'Description',
|
||||
host_catalog_id: '123',
|
||||
compositeType: 'aws',
|
||||
address: '188e:68a9:b342:c05c:2595:2f46:499c:759f',
|
||||
});
|
||||
|
||||
let serializedRecord = record.serialize();
|
||||
|
||||
assert.ok(serializedRecord);
|
||||
assert.deepEqual(recordAws.serialize(), {
|
||||
name: 'Host 2',
|
||||
description: 'Description',
|
||||
host_catalog_id: '123',
|
||||
type: 'plugin',
|
||||
attributes: {
|
||||
address: '188e:68a9:b342:c05c:2595:2f46:499c:759f',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user