2021-07-15 09:38:06 +00:00
|
|
|
import { resolve } from 'path'
|
|
|
|
import { setupTest, startServer, testNitroBehavior, importModule } from './_tests.mjs'
|
2021-04-23 19:52:32 +00:00
|
|
|
|
|
|
|
describe('nitro:preset:vercel', () => {
|
2021-07-15 09:38:06 +00:00
|
|
|
const ctx = setupTest('vercel')
|
2021-04-23 19:52:32 +00:00
|
|
|
testNitroBehavior(ctx, async () => {
|
2021-07-15 09:38:06 +00:00
|
|
|
const handle = await importModule(resolve(ctx.outDir, 'functions/node/server/index.mjs'))
|
2021-04-23 19:52:32 +00:00
|
|
|
.then(r => r.default || r)
|
|
|
|
await startServer(ctx, handle)
|
|
|
|
return async ({ url }) => {
|
|
|
|
const data = await ctx.fetch(url)
|
|
|
|
return {
|
|
|
|
data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|