rsnext/test/integration/export-serverless/test/api-routes.js
JJ Kasper 6fcb6230d2 Add support for exporting from serverless build (#9744)
* Add support for exporting from serverless build

* Add more tests

* Update syntax

* Dont add dynamic params in worker

* Update amphtml rel for serverless tests

* Update tests again

* Update dynamic params populating

* Fix params parsing

* Pass params separately
2019-12-14 01:31:48 -05:00

28 lines
782 B
JavaScript

/* eslint-env jest */
import { join } from 'path'
import { File, runNextCommand } from 'next-test-utils'
export default function(context) {
describe('API routes export', () => {
const nextConfig = new File(join(context.appDir, 'next.config.js'))
beforeEach(() => {
nextConfig.replace('// API route', `'/data': { page: '/api/data' },`)
})
afterEach(() => {
nextConfig.restore()
})
it('Should throw if a route is matched', async () => {
const outdir = join(context.appDir, 'outApi')
const { stdout } = await runNextCommand(
['export', context.appDir, '--outdir', outdir],
{ stdout: true }
)
expect(stdout).toContain(
'https://err.sh/zeit/next.js/api-routes-static-export'
)
})
})
}