From cdaf7f6bc55d33db101813908db9844b971e28b8 Mon Sep 17 00:00:00 2001 From: Cansu Aksu Date: Wed, 7 Aug 2024 17:32:16 +0200 Subject: [PATCH] chore: Add another test --- test/components/third-party-import-types.test.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/components/third-party-import-types.test.ts b/test/components/third-party-import-types.test.ts index 218878b..40b4fba 100644 --- a/test/components/third-party-import-types.test.ts +++ b/test/components/third-party-import-types.test.ts @@ -2,8 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 import { buildProject } from './test-helpers'; import { ComponentDefinition } from '../../src'; +import * as bootstrap from '../../src/bootstrap'; import process from 'node:process'; const cwd = process.cwd(); +const nodeModulesPath = `${cwd}/fixtures/components/third-party-import-types/node_modules_mock/icon/interfaces.d.ts`; test('should resolve object type to string', () => { const resultBefore = buildProject('third-party-import-types'); @@ -24,9 +26,7 @@ test('should resolve object type to string', () => { }, ]); - const resultAfter = buildProject('third-party-import-types', [ - `${cwd}/fixtures/components/third-party-import-types/node_modules_mock/icon/interfaces.d.ts`, - ]); + const resultAfter = buildProject('third-party-import-types', [nodeModulesPath]); const buttonAfter: ComponentDefinition | undefined = resultAfter.find(component => component.name === 'Button'); expect(buttonAfter?.properties).toEqual([ @@ -44,3 +44,13 @@ test('should resolve object type to string', () => { }, ]); }); + +test('passing nodeModulesInputFilePaths should enable includeDeclarations and excludeExternals', () => { + const bootstrapProjectSpy = jest.spyOn(bootstrap, 'bootstrapProject'); + buildProject('third-party-import-types', [nodeModulesPath]); + + expect(bootstrapProjectSpy.mock.calls[0][0].includeDeclarations).toBe(true); + expect(bootstrapProjectSpy.mock.calls[0][0].excludeExternals).toBe(true); + + jest.restoreAllMocks(); +});