test(cpa): update tests
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { parseAndModifyConfigContent, withPayloadImportStatement } from './wrap-next-config.js'
|
import { parseAndModifyConfigContent, withPayloadImportStatement } from './wrap-next-config.js'
|
||||||
|
import * as p from '@clack/prompts'
|
||||||
|
|
||||||
const defaultNextConfig = `/** @type {import('next').NextConfig} */
|
const defaultNextConfig = `/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {};
|
const nextConfig = {};
|
||||||
@@ -47,7 +48,7 @@ describe('parseAndInsertWithPayload', () => {
|
|||||||
|
|
||||||
// Unsupported: export { wrapped as default }
|
// Unsupported: export { wrapped as default }
|
||||||
it('should give warning with a named export as default', () => {
|
it('should give warning with a named export as default', () => {
|
||||||
const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => {})
|
const warnLogSpy = jest.spyOn(p.log, 'warn').mockImplementation(() => {})
|
||||||
|
|
||||||
const { modifiedConfigContent, success } = parseAndModifyConfigContent(
|
const { modifiedConfigContent, success } = parseAndModifyConfigContent(
|
||||||
nextConfigExportNamedDefault,
|
nextConfigExportNamedDefault,
|
||||||
@@ -55,8 +56,6 @@ describe('parseAndInsertWithPayload', () => {
|
|||||||
expect(modifiedConfigContent).toContain(withPayloadImportStatement)
|
expect(modifiedConfigContent).toContain(withPayloadImportStatement)
|
||||||
expect(success).toBe(false)
|
expect(success).toBe(false)
|
||||||
|
|
||||||
expect(consoleLogSpy).toHaveBeenCalledWith(
|
expect(warnLogSpy).toHaveBeenCalledWith(expect.stringContaining('Could not automatically wrap'))
|
||||||
expect.stringContaining('Could not automatically wrap'),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ describe('create-payload-app', () => {
|
|||||||
'--debug': true,
|
'--debug': true,
|
||||||
projectDir,
|
projectDir,
|
||||||
nextConfigPath: path.resolve(projectDir, 'next.config.mjs'),
|
nextConfigPath: path.resolve(projectDir, 'next.config.mjs'),
|
||||||
|
dbType: 'mongodb',
|
||||||
useDistFiles: true, // create-payload-app/dist/app/(payload)
|
useDistFiles: true, // create-payload-app/dist/app/(payload)
|
||||||
packageManager: 'pnpm',
|
packageManager: 'pnpm',
|
||||||
})
|
})
|
||||||
@@ -91,6 +92,7 @@ describe('create-payload-app', () => {
|
|||||||
'--debug': true,
|
'--debug': true,
|
||||||
projectDir,
|
projectDir,
|
||||||
nextConfigPath: path.resolve(projectDir, 'next.config.mjs'),
|
nextConfigPath: path.resolve(projectDir, 'next.config.mjs'),
|
||||||
|
dbType: 'mongodb',
|
||||||
useDistFiles: true, // create-payload-app/dist/app/(payload)
|
useDistFiles: true, // create-payload-app/dist/app/(payload)
|
||||||
packageManager: 'pnpm',
|
packageManager: 'pnpm',
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user