fix: 🐛 fix broken tests and linting
This commit is contained in:
4 files changed
+5
-6
No files matched your search
@@ -14,7 +14,7 @@ export default class TargetSerializer extends ApplicationSerializer {
|
||||
*/
|
||||
serialize(snapshot) {
|
||||
let serialized = super.serialize(...arguments);
|
||||
const hostSets = snapshot?.adapterOptions?.hostSetIDs;
|
||||
const hostSetIDs = snapshot?.adapterOptions?.hostSetIDs;
|
||||
if (hostSetIDs) serialized =
|
||||
this.serializeWithHostSets(snapshot, hostSetIDs);
|
||||
return serialized;
|
||||
|
||||
@@ -87,7 +87,7 @@ module('Unit | Model | target', function (hooks) {
|
||||
}
|
||||
});
|
||||
const model = store.peekRecord('target', '123abc');
|
||||
await model.addHostSets([{id: '123_abc'}, {id: 'foobar'}]);
|
||||
await model.addHostSets(['123_abc', 'foobar']);
|
||||
});
|
||||
|
||||
test('it has a `deleteHostSets` method that targets a specific POST API endpoint and serialization', async function (assert) {
|
||||
@@ -120,6 +120,6 @@ module('Unit | Model | target', function (hooks) {
|
||||
}
|
||||
});
|
||||
const model = store.peekRecord('target', '123abc');
|
||||
await model.deleteHostSets([{id: '1'}, {id: '3'}]);
|
||||
await model.deleteHostSets(['1', '3']);
|
||||
});
|
||||
});
|
||||
@@ -29,7 +29,7 @@ module('Unit | Serializer | target', function(hooks) {
|
||||
|
||||
});
|
||||
|
||||
test('it serializes only host sets and version when an `adapterOptions.hostSets` array is passed', function (assert) {
|
||||
test('it serializes only host sets and version when an `adapterOptions.hostSetIDs` array is passed', function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const serializer = store.serializerFor('target');
|
||||
@@ -44,7 +44,7 @@ module('Unit | Serializer | target', function(hooks) {
|
||||
});
|
||||
const snapshot = record._createSnapshot();
|
||||
snapshot.adapterOptions = {
|
||||
hostSets: [{id: '4'}, {id: '5'}]
|
||||
hostSetIDs: ['4', '5']
|
||||
};
|
||||
const serializedRecord = serializer.serialize(snapshot);
|
||||
assert.deepEqual(serializedRecord, {
|
||||
|
||||
@@ -149,7 +149,6 @@ export default function() {
|
||||
}
|
||||
// If deleting host sets, filter them out of the array
|
||||
if (method === 'delete-host-sets') {
|
||||
console.log(method, attrs);
|
||||
updatedAttrs.hostSetIds = updatedAttrs.hostSetIds.filter(id => {
|
||||
return !attrs.hostSetIds.includes(id);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user