Skip to content

Commit

Permalink
fix cli tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KarolNet committed Jan 18, 2022
1 parent dfb536e commit d28412d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ exports.sourceNodes = async (gatsbyFunctions, options) => {

if (lastUpdate && lastUpdate.updated_at) {
removed = await getDeletedObjects(gatsbyFunctions, options, lastUpdate.updated_at, contentTypeDefsData, apiUrl, async (ctd, id) => {
let node = existingNodes.find(n => n.id === ctd.name + '_' + id);
let node = existingNodes.find(n => n.id === `${ctd.name}_${id}`);
return await deleteNode({node});
});
}
Expand All @@ -91,7 +91,7 @@ exports.sourceNodes = async (gatsbyFunctions, options) => {
// custom
flotiqInternal: datum.internal,
// required
id: ctd.name === '_media' ? datum.id : ctd.name + '_' + datum.id,
id: ctd.name === '_media' ? datum.id : `${ctd.name}_${datum.id}`,
parent: null,
children: [],
internal: {
Expand All @@ -102,17 +102,17 @@ exports.sourceNodes = async (gatsbyFunctions, options) => {
})

if (changed) {
reporter.info('Updated entries ' + changed);
reporter.info(`Updated entries ${changed}`);
}
if (removed) {
reporter.info('Removed entries ' + removed);
reporter.info(`Removed entries ${removed}`);
}
setPluginStatus({
'updated_at':
(new Date()).toISOString().replace(/T/, ' ').replace(/\..+/, '')
});
} catch (e) {
reporter.panic('FLOTIQ: ' + e.message)
reporter.panic(`FLOTIQ: ${e.message}`)
}

return {};
Expand Down Expand Up @@ -219,7 +219,7 @@ exports.createResolvers = ({
createNode,
createNodeId,
reporter,
ext: '.' + source.extension
ext: `.${source.extension}`
});
}
}
Expand Down Expand Up @@ -299,7 +299,7 @@ const getType = (propertyConfig, required, property, ctdName) => {
let typeNonCapitalize = (propertyConfig.validation.relationContenttype !== '_media' ?
propertyConfig.validation.relationContenttype : '_media');
return {
type: '[' + type + ']',
type: `[${type}]`,
resolve: async (source, args, context, info) => {
if (source[property]) {
let nodes = await Promise.all(source[property].map(async (prop) => {
Expand All @@ -322,7 +322,7 @@ const getType = (propertyConfig, required, property, ctdName) => {
// custom
flotiqInternal: json.internal,
// required
id: typeNonCapitalize === '_media' ? json.id : typeNonCapitalize + '_' + json.id,
id: typeNonCapitalize === '_media' ? json.id : `${typeNonCapitalize}_${json.id}`,
parent: null,
children: [],
internal: {
Expand All @@ -348,7 +348,7 @@ const getType = (propertyConfig, required, property, ctdName) => {
}
};
case 'object':
return '[' + capitalize(property) + ctdName + ']';
return `[${capitalize(property)}${ctdName}]`;
case 'block':
return 'FlotiqBlock'
}
Expand Down
4 changes: 2 additions & 2 deletions src/data-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports.getContentTypes = async function (options, apiUrl) {
} = options;

let contentTypeDefinitionsResponse = await fetch(
apiUrl + '/api/v1/internal/contenttype?limit=10000&order_by=label',
`${apiUrl}/api/v1/internal/contenttype?limit=10000&order_by=label`,
{
headers: createHeaders(options),
timeout: timeout
Expand All @@ -34,7 +34,7 @@ module.exports.getDeletedObjects = async function (gatsbyFunctions, options, sin
const { reporter } = gatsbyFunctions;
await Promise.all(contentTypes.map(async ctd => {

let url = apiUrl + '/api/v1/content/' + ctd.name + '/removed?deletedAfter=' + encodeURIComponent(since);
let url = `${apiUrl}/api/v1/content/${ctd.name}/removed?deletedAfter=${encodeURIComponent(since)}`;
let response = await fetch(url, {headers: createHeaders(options)});
reporter.info(`Fetching removed content type ${ctd.name}: ${url}`);
if (response.ok) {
Expand Down

0 comments on commit d28412d

Please sign in to comment.