PR suggestions applied
This commit is contained in:
1 parent
4f14891c84
commit
e52093c6ed
3 files changed
+5
-6
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
const fieldByType = {
|
||||
aws: ['filters'],
|
||||
azure: ['filter'],
|
||||
aws: ['preferred_endpoints', 'filters'],
|
||||
azure: ['preferred_endpoints', 'filter'],
|
||||
};
|
||||
export default class HostSetSerializer extends ApplicationSerializer {
|
||||
// =properties
|
||||
@@ -53,6 +53,7 @@ export default class HostSetSerializer extends ApplicationSerializer {
|
||||
let serialized = super.serialize(...arguments);
|
||||
// Delete unnecessary fields for static type
|
||||
delete serialized.attributes;
|
||||
delete serialized.preferred_endpoints;
|
||||
return serialized;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export default factory.extend({
|
||||
},
|
||||
// AWS specific
|
||||
filters() {
|
||||
if (this.type === 'plugin' && this.plugin?.name === 'aws') {
|
||||
if (this.plugin?.name === 'aws') {
|
||||
const filtersAmount = datatype.number({ min: 1, max: 5 });
|
||||
let result = [];
|
||||
for (let i = 0; i < filtersAmount; ++i) {
|
||||
@@ -42,7 +42,7 @@ export default factory.extend({
|
||||
},
|
||||
// Azure specific
|
||||
filter() {
|
||||
if (this.type === 'plugin' && this.plugin?.name === 'azure') {
|
||||
if (this.plugin?.name === 'azure') {
|
||||
return `${database.column}=${database.collation}`;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -13,14 +13,12 @@ module('Unit | Serializer | host set', function (hooks) {
|
||||
description: 'Description',
|
||||
host_catalog_id: '123',
|
||||
version: 1,
|
||||
preferred_endpoints: [{ value: 'option 1' }, { value: 'option 2' }],
|
||||
});
|
||||
assert.deepEqual(record.serialize(), {
|
||||
name: 'Host Set 1',
|
||||
description: 'Description',
|
||||
host_catalog_id: '123',
|
||||
version: 1,
|
||||
preferred_endpoints: ['option 1', 'option 2'],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user