Skip to content

Commit

Permalink
test tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Aug 24, 2023
1 parent 61a411a commit 9f6f1ef
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions test/e2e/app-dir/app-static/app-static.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2312,37 +2312,44 @@ createNextDescribe(
})

if (process.env.CUSTOM_CACHE_HANDLER && !isNextDeploy) {
let nextConfig
describe('custom cache handler initialization check', () => {
describe.only('custom cache handler initialization check', () => {
beforeAll(async () => {
await next.stop()
nextConfig = await next.readFile('./next.config.js')
})

afterAll(async () => {
await next.start()
})

it('should have logs from cache-handler', async () => {
let { cliOutput } = await next.build()
expect(cliOutput).toContain('initialized custom cache-handler')
expect(cliOutput).toContain('cache-handler get')
expect(cliOutput).toContain('cache-handler set')

// try with transpiled cache handler
const nextConfig = await next.readFile('./next.config.js')
await next.patchFile(
'./next.config.js',
nextConfig.replace(
'cache-handler.js',
'cache-handler-default-export.js'
)
)
await next.start()
})

afterAll(async () => {
await next.stop()
cliOutput = (await next.build()).cliOutput

expect(cliOutput).toContain('initialized custom cache-handler')
expect(cliOutput).toContain('cache-handler get')
expect(cliOutput).toContain('cache-handler set')

await next.patchFile(
'./next.config.js',
nextConfig.replace(
'cache-handler-default-export.js',
'cache-handler.js'
'cache-handle.js'
)
)
await next.start()
})

it('should have logs from cache-handler', () => {
expect(next.cliOutput).toContain('initialized custom cache-handler')
expect(next.cliOutput).toContain('cache-handler get')
expect(next.cliOutput).toContain('cache-handler set')
})
})
}
Expand Down

0 comments on commit 9f6f1ef

Please sign in to comment.