Added core type integrations to API serializer

This commit is contained in:
Aileen Nowak 2022-08-11 12:40:33 +01:00 committed by Aileen Booker
parent 0e284edbad
commit 5ac779f86b
3 changed files with 9 additions and 9 deletions

View File

@ -3,9 +3,9 @@ const debug = require('@tryghost/debug')('api:endpoints:utils:serializers:input:
function setDefaultFilter(frame) {
if (frame.options.filter) {
frame.options.filter = `(${frame.options.filter})+type:[custom,builtin]`;
frame.options.filter = `(${frame.options.filter})+type:[custom,builtin,core]`;
} else {
frame.options.filter = 'type:[custom,builtin]';
frame.options.filter = 'type:[custom,builtin,core]';
}
}

View File

@ -12,7 +12,7 @@ describe('Unit: endpoints/utils/serializers/input/pages', function () {
};
serializers.input.integrations.browse(apiConfig, frame);
frame.options.filter.should.eql('type:[custom,builtin]');
frame.options.filter.should.eql('type:[custom,builtin,core]');
});
it('combines filters', function () {
@ -25,7 +25,7 @@ describe('Unit: endpoints/utils/serializers/input/pages', function () {
};
serializers.input.integrations.browse(apiConfig, frame);
frame.options.filter.should.eql('(type:internal)+type:[custom,builtin]');
frame.options.filter.should.eql('(type:internal)+type:[custom,builtin,core]');
});
});
@ -39,7 +39,7 @@ describe('Unit: endpoints/utils/serializers/input/pages', function () {
};
serializers.input.integrations.read(apiConfig, frame);
frame.options.filter.should.eql('type:[custom,builtin]');
frame.options.filter.should.eql('type:[custom,builtin,core]');
});
it('combines filters', function () {
@ -52,7 +52,7 @@ describe('Unit: endpoints/utils/serializers/input/pages', function () {
};
serializers.input.integrations.read(apiConfig, frame);
frame.options.filter.should.eql('(type:internal)+type:[custom,builtin]');
frame.options.filter.should.eql('(type:internal)+type:[custom,builtin,core]');
});
});
});

View File

@ -60,11 +60,11 @@ describe('Unit: models/integration', function () {
return models.Integration.findOne({
id: '123'
}, {
filter: 'type:[custom,builtin]'
filter: 'type:[custom,builtin,core]'
}).then(() => {
queries.length.should.eql(1);
queries[0].sql.should.eql('select `integrations`.* from `integrations` where `integrations`.`type` in (?, ?) and `integrations`.`id` = ? limit ?');
queries[0].bindings.should.eql(['custom', 'builtin', '123', 1]);
queries[0].sql.should.eql('select `integrations`.* from `integrations` where `integrations`.`type` in (?, ?, ?) and `integrations`.`id` = ? limit ?');
queries[0].bindings.should.eql(['custom', 'builtin', 'core', '123', 1]);
});
});
});