Skip to content

Commit

Permalink
custom scripts fail AMP validation now
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed May 2, 2024
1 parent ff91852 commit 533827f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/integration/amphtml/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ describe('AMP Usage', () => {
let output = ''

beforeAll(async () => {
await rename(
join(appDir, 'pages/custom-scripts.js'),
join(appDir, 'pages/custom-scripts.js.bak')
)
await rename(
join(appDir, 'pages/invalid-amp.js'),
join(appDir, 'pages/invalid-amp.js.bak')
Expand All @@ -46,6 +50,10 @@ describe('AMP Usage', () => {
app = await nextStart(appDir, context.appPort)
})
afterAll(async () => {
await rename(
join(appDir, 'pages/custom-scripts.js.bak'),
join(appDir, 'pages/custom-scripts.js')
)
await rename(
join(appDir, 'pages/invalid-amp.js.bak'),
join(appDir, 'pages/invalid-amp.js')
Expand Down Expand Up @@ -536,6 +544,25 @@ describe('AMP Usage', () => {
expect(inspectPayload).toContain('error')
})

it('should detect amp validator warning on custom scripts', async () => {
let inspectPayload = ''
dynamicAppPort = await findPort()
ampDynamic = await launchApp(join(__dirname, '../'), dynamicAppPort, {
onStdout(msg) {
inspectPayload += msg
},
onStderr(msg) {
inspectPayload += msg
},
})

await renderViaHTTP(dynamicAppPort, '/custom-scripts')

await killApp(ampDynamic)

expect(inspectPayload).toContain('error')
})

it('should not contain missing files warning', async () => {
expect(output).toContain('Compiled /only-amp')
expect(output).not.toContain('Could not find files for')
Expand Down

0 comments on commit 533827f

Please sign in to comment.