diff --git a/packages/mdctl-core/test/section.test.js b/packages/mdctl-core/test/section.test.js index c79196a8..40c078c9 100644 --- a/packages/mdctl-core/test/section.test.js +++ b/packages/mdctl-core/test/section.test.js @@ -1,6 +1,6 @@ /* eslint-disable no-underscore-dangle */ const assert = require('assert'), - { ExportSection } = require('../streams/section') + { ExportSection } = require('../streams/section') describe('ExportSection', () => { let exportSection @@ -20,9 +20,9 @@ describe('ExportSection', () => { it('should add itself to sectionsWithResources if it has resourceIds and sectionsWithResources is an array', () => { const sectionsWithResources = [], - content = { - resourceId: 'resource1' - } + content = { + resourceId: 'resource1' + } exportSection = new ExportSection(content, 'key', sectionsWithResources) assert.strictEqual(sectionsWithResources.length, 1) @@ -31,7 +31,7 @@ describe('ExportSection', () => { it('should not add itself to sectionsWithResources if it does not have resourceIds', () => { const sectionsWithResources = [], - content = {} + content = {} exportSection = new ExportSection(content, 'key', sectionsWithResources) assert.strictEqual(sectionsWithResources.length, 0) @@ -39,9 +39,9 @@ describe('ExportSection', () => { it('should not add itself to sectionsWithResources if sectionsWithResources is not an array', () => { const sectionsWithResources = {}, - content = { - resourceId: 'resource1' - } + content = { + resourceId: 'resource1' + } exportSection = new ExportSection(content, 'key', sectionsWithResources) assert.strictEqual(sectionsWithResources.length, undefined) @@ -51,45 +51,45 @@ describe('ExportSection', () => { describe('extractAssets', () => { it('should add extraFiles to the exportSection if resource is found in sectionsWithResources #CTXAPI-2569', () => { const chunks = [ - { - name: 'Section 1 with resources', - object: 'env', - resource: 'env', - favicon: [ - { - filename: 'favicon.ico', - name: 'content', - mime: 'image/x-icon', - object: 'facet', - resourceId: 'e6bd7abd-d7b8-42af-a5d8-52666fc44943' - } - ], - }, - { - name: 'Section 2 with resources', - logo: [ - { - filename: 'medable_logo_sm.png', - name: 'content', - mime: 'image/png', - object: 'facet', - resourceId: '1d1de797-6a1e-4d7e-a3c8-b76f4a4b4df1' - }, - { - filename: 'medable_logo_sm.png', - name: 'thumbnail', - mime: 'image/png', - object: 'facet', - resourceId: 'adfa4f86-f6e5-4f6c-b52f-98a55ba4815f' - } - ], - object: 'env', - resource: 'env', - }, - ], - - sectionsWithResources = [], - sections = [] + { + name: 'Section 1 with resources', + object: 'env', + resource: 'env', + favicon: [ + { + filename: 'favicon.ico', + name: 'content', + mime: 'image/x-icon', + object: 'facet', + resourceId: 'e6bd7abd-d7b8-42af-a5d8-52666fc44943' + } + ], + }, + { + name: 'Section 2 with resources', + logo: [ + { + filename: 'medable_logo_sm.png', + name: 'content', + mime: 'image/png', + object: 'facet', + resourceId: '1d1de797-6a1e-4d7e-a3c8-b76f4a4b4df1' + }, + { + filename: 'medable_logo_sm.png', + name: 'thumbnail', + mime: 'image/png', + object: 'facet', + resourceId: 'adfa4f86-f6e5-4f6c-b52f-98a55ba4815f' + } + ], + object: 'env', + resource: 'env', + }, + ], + + sectionsWithResources = [], + sections = [] chunks.forEach((chunk) => { // eslint-disable-next-line no-new @@ -132,19 +132,19 @@ describe('ExportSection', () => { describe('extractScripts', () => { it('should not process scripts if the object is i18n', () => { - const section = new ExportSection({ - object: 'i18n', - resourceId: 'resource1', - data: { - script: { - invalidArgument: { - message: 'Invalid script.' - } + const section = new ExportSection({ + object: 'i18n', + resourceId: 'resource1', + data: { + script: { + invalidArgument: { + message: 'Invalid script.' } } - }, 'i18n', []) - section.extractScripts() - assert.strictEqual(section.scriptFiles.length, 0) + } + }, 'i18n', []) + section.extractScripts() + assert.strictEqual(section.scriptFiles.length, 0) }) }) })