test(cpa): update tests

This commit is contained in:
Elliot DeNolf
2024-04-01 10:32:17 -04:00
parent 3c54d32b6d
commit 7cfc40f328
2 changed files with 5 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
import { parseAndModifyConfigContent, withPayloadImportStatement } from './wrap-next-config.js'
import * as p from '@clack/prompts'
const defaultNextConfig = `/** @type {import('next').NextConfig} */
const nextConfig = {};
@@ -47,7 +48,7 @@ describe('parseAndInsertWithPayload', () => {
// Unsupported: export { wrapped 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(
nextConfigExportNamedDefault,
@@ -55,8 +56,6 @@ describe('parseAndInsertWithPayload', () => {
expect(modifiedConfigContent).toContain(withPayloadImportStatement)
expect(success).toBe(false)
expect(consoleLogSpy).toHaveBeenCalledWith(
expect.stringContaining('Could not automatically wrap'),
)
expect(warnLogSpy).toHaveBeenCalledWith(expect.stringContaining('Could not automatically wrap'))
})
})

View File

@@ -67,6 +67,7 @@ describe('create-payload-app', () => {
'--debug': true,
projectDir,
nextConfigPath: path.resolve(projectDir, 'next.config.mjs'),
dbType: 'mongodb',
useDistFiles: true, // create-payload-app/dist/app/(payload)
packageManager: 'pnpm',
})
@@ -91,6 +92,7 @@ describe('create-payload-app', () => {
'--debug': true,
projectDir,
nextConfigPath: path.resolve(projectDir, 'next.config.mjs'),
dbType: 'mongodb',
useDistFiles: true, // create-payload-app/dist/app/(payload)
packageManager: 'pnpm',
})