{"version":3,"file":"pre-local.test.mjs","names":[],"sources":["../../../src/tests/pre-local.test.ts"],"sourcesContent":["import { preLocal } from '../pre-local';\n\nimport type SwcServerlessPlugin from '../index';\n\nconst chdirSpy = jest.spyOn(process, 'chdir').mockImplementation();\n\nafterEach(() => {\n  jest.resetAllMocks();\n});\n\nit('should call chdir with the buildDirPath if the invoked function is a node function', () => {\n  const swcPlugin = {\n    buildDirPath: 'workdir/.build',\n    serverless: {\n      config: {},\n    },\n    options: {\n      function: 'hello',\n    },\n    functions: {\n      hello: {},\n    },\n  };\n\n  preLocal.call(swcPlugin as unknown as SwcServerlessPlugin);\n\n  expect(chdirSpy).toHaveBeenCalledWith(swcPlugin.buildDirPath);\n});\n\nit('should not call chdir if the invoked function is not a node function', () => {\n  const swcPlugin = {\n    buildDirPath: 'workdir/.build',\n    serverless: {\n      config: {},\n    },\n    options: {\n      function: 'hello',\n    },\n    functions: {},\n  };\n\n  preLocal.call(swcPlugin as unknown as SwcServerlessPlugin);\n\n  expect(chdirSpy).not.toHaveBeenCalled();\n});\n"],"mappings":";;;gBAAwC;AAIxC,MAAM,WAAW,KAAK,MAAM,SAAS,QAAQ,CAAC,oBAAoB;AAElE,gBAAgB;AACd,MAAK,eAAe;EACpB;AAEF,GAAG,4FAA4F;CAC7F,MAAM,YAAY;EAChB,cAAc;EACd,YAAY,EACV,QAAQ,EAAE,EACX;EACD,SAAS,EACP,UAAU,SACX;EACD,WAAW,EACT,OAAO,EAAE,EACV;EACF;AAED,UAAS,KAAK,UAA4C;AAE1D,QAAO,SAAS,CAAC,qBAAqB,UAAU,aAAa;EAC7D;AAEF,GAAG,8EAA8E;AAY/E,UAAS,KAXS;EAChB,cAAc;EACd,YAAY,EACV,QAAQ,EAAE,EACX;EACD,SAAS,EACP,UAAU,SACX;EACD,WAAW,EAAE;EACd,CAEyD;AAE1D,QAAO,SAAS,CAAC,IAAI,kBAAkB;EACvC"}