Skip to content

Commit 66612f0

Browse files
chore: add tests
1 parent 7d836b8 commit 66612f0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// noop

test/helpers/files.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,13 @@ describe('getSourceFileForPage', () => {
237237

238238
expect(filePath.replace(TEST_DIR, '')).toBe('/fixtures/page-extensions/custom/pages/api/custom.api.js')
239239
})
240+
241+
it("handles getting file when index of folder", () => {
242+
const pagesDir = resolve(__dirname, '../fixtures/page-extensions/index/pages')
243+
const apiRoute = '/api/index'
244+
245+
const filePath = getSourceFileForPage(apiRoute, [pagesDir])
246+
247+
expect(filePath.replace(TEST_DIR, '')).toBe('/fixtures/page-extensions/default/pages/api/index/index.api.js')
248+
})
240249
})

0 commit comments

Comments
 (0)