diff --git a/.circleci/config.yml b/.circleci/config.yml index b4dec6ee..646c05e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ jobs: steps: - checkout - node/install: - node-version: '18.15' + node-version: '18' - node/install-packages - run: name: Lint @@ -31,7 +31,7 @@ jobs: steps: - checkout - node/install: - node-version: '18.15' + node-version: '18' - node/install-packages - run: name: Run Unit Tests @@ -43,7 +43,7 @@ jobs: steps: - checkout - node/install: - node-version: '18.15' + node-version: '18' - node/install-packages - run: name: Run Integration Tests @@ -55,7 +55,7 @@ jobs: steps: - checkout - node/install: - node-version: '18.15' + node-version: '18' - node/install-packages - run: name: Run E2E Tests @@ -67,7 +67,7 @@ jobs: steps: - checkout - node/install: - node-version: '18.15' + node-version: '18' - node/install-packages - vault/get-secrets: template-preset: 'semantic-release-ecosystem' diff --git a/src/lib/offline-api/index.ts b/src/lib/offline-api/index.ts index e57c880d..7e28a648 100644 --- a/src/lib/offline-api/index.ts +++ b/src/lib/offline-api/index.ts @@ -1,4 +1,4 @@ -import { omit, compact, get } from 'lodash' +import { omit, compact, get, isArray } from 'lodash' import FieldDeletionValidator from './validator/field-deletion' import { ContentTypePayloadValidator } from './validator/content-type' import { TagSchemaValidator } from './validator/tag' @@ -529,8 +529,8 @@ class OfflineAPI { if (get(field, 'sys.id') === childId) { links.push(new Link(entry, key, locale)) } - if (field instanceof Array) { - const fieldArray = field + if (isArray(field)) { + const fieldArray: any[] = field fieldArray.forEach((fieldEntry, index) => { if (get(fieldEntry, 'sys.id') === childId) { links.push(new Link(entry, key, locale, index)) diff --git a/test/setup.js b/test/setup.js index 6a010843..d9dbb988 100644 --- a/test/setup.js +++ b/test/setup.js @@ -3,8 +3,10 @@ const chai = require('chai') const dirtyChai = require('dirty-chai') const sinonChai = require('sinon-chai') -const chaiAsPromised = require('chai-as-promised') +const chaiAsPromised = import('chai-as-promised') -chai.use(sinonChai) -chai.use(dirtyChai) -chai.use(chaiAsPromised) +;(async () => { + chai.use(sinonChai) + chai.use(dirtyChai) + chai.use(await chaiAsPromised) +})()