Skip to content

Commit

Permalink
fix: mockRoutes string mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed Aug 5, 2023
1 parent 2412f14 commit 94d8f4c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/cli/createRouteString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const createCondition = (
inputDir: string,
methods: string,
trailingSlash: boolean
) => `
{ path: '${createImportPath(filePath, inputDir).replace(/(\/index)$/, '') || ''}${
trailingSlash ? '/' : ''
}', methods: ${methods} }`;
) =>
` { path: '${createImportPath(filePath, inputDir).replace(/(\/index)$/, '') || ''}${
trailingSlash ? '/' : ''
}', methods: ${methods} },\n`;

export default (
inputDir: string,
Expand All @@ -27,10 +27,10 @@ ${hasMiddleware ? "import baseMiddleware from './@middleware';\n" : ''}import ap
${pathList
.map((filePath, i) => `import mock${i} from '.${createImportPath(filePath, inputDir)}';\n`)
.join('')}
export const mockRoutes = () => [${pathList
.map((filePath, i) => createCondition(filePath, inputDir, `mock${i}`, trailingSlash))
.join(',')},
];
export const mockRoutes = () => [
${pathList
.map((filePath, i) => createCondition(filePath, inputDir, `mock${i}`, trailingSlash))
.join('')}];
export default <U>(client: AspidaClient<U> | MockClient<U>, config?: MockConfig | undefined) => {${
hasMiddleware
Expand Down

0 comments on commit 94d8f4c

Please sign in to comment.