Ghost/ghost/extract-api-key/test/extract-api-key.test.js
Naz 988acff403 Simplified returned data from api key extraction
refs https://github.com/TryGhost/Toolbox/issues/292

- We can query the data base by the API key itself, there's no need for type of the API  at any point yet
2022-05-10 14:44:55 +08:00

25 lines
589 B
JavaScript

const assert = require('assert');
const extractApiKey = require('../index');
describe('Extract API Key', function () {
it('Returns nulls for a request without any key', function () {
const key = extractApiKey({
query: {
filter: 'status:active'
}
});
assert.equal(key, null);
});
it('Extracts Content API key from the request', function () {
const key = extractApiKey({
query: {
key: '123thekey'
}
});
assert.equal(key, '123thekey');
});
});