From f73dc29d162cf487adb6c3fd8606fdc71a92f536 Mon Sep 17 00:00:00 2001 From: Javier Sierra Date: Tue, 19 Dec 2023 09:40:59 +0100 Subject: [PATCH] fix: check for empty schemaPaths flag --- src/services/user-flow-steps.js | 3 ++- test/unit/services/user-flow-steps.test.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/user-flow-steps.js b/src/services/user-flow-steps.js index b8940f1..10a4d38 100644 --- a/src/services/user-flow-steps.js +++ b/src/services/user-flow-steps.js @@ -85,7 +85,8 @@ async function init({ origin, schemaPaths, ports } = { schemaPaths: [], ports: [ } const schemasFilePaths = schemas.map((s) => s.filePath); - const schemaPathsAreAvailable = schemaPaths?.every((path) => schemasFilePaths.includes(path)); + const schemaPathsAreAvailable = + Boolean(schemaPaths.length) && schemaPaths.every((path) => schemasFilePaths.includes(path)); const schemasToMock = schemaPathsAreAvailable ? schemaPaths diff --git a/test/unit/services/user-flow-steps.test.js b/test/unit/services/user-flow-steps.test.js index 7e43041..6d71e93 100644 --- a/test/unit/services/user-flow-steps.test.js +++ b/test/unit/services/user-flow-steps.test.js @@ -115,6 +115,8 @@ describe('unit: user-flow-steps', () => { inquirerInputStub.resolves(localSchema.port); const config = await userFlowSteps.init({ origin: localSchema.path, + port: [], + schemaPaths: [], }); expect(findOasFromDirStub).to.have.been.calledWith(localSchema.path); expect(inquirerCheckboxStub).to.have.been.calledWith(match.object);