Skip to content

Commit 533827f

Browse files
committed
custom scripts fail AMP validation now
1 parent ff91852 commit 533827f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/integration/amphtml/test/index.test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ describe('AMP Usage', () => {
3131
let output = ''
3232

3333
beforeAll(async () => {
34+
await rename(
35+
join(appDir, 'pages/custom-scripts.js'),
36+
join(appDir, 'pages/custom-scripts.js.bak')
37+
)
3438
await rename(
3539
join(appDir, 'pages/invalid-amp.js'),
3640
join(appDir, 'pages/invalid-amp.js.bak')
@@ -46,6 +50,10 @@ describe('AMP Usage', () => {
4650
app = await nextStart(appDir, context.appPort)
4751
})
4852
afterAll(async () => {
53+
await rename(
54+
join(appDir, 'pages/custom-scripts.js.bak'),
55+
join(appDir, 'pages/custom-scripts.js')
56+
)
4957
await rename(
5058
join(appDir, 'pages/invalid-amp.js.bak'),
5159
join(appDir, 'pages/invalid-amp.js')
@@ -536,6 +544,25 @@ describe('AMP Usage', () => {
536544
expect(inspectPayload).toContain('error')
537545
})
538546

547+
it('should detect amp validator warning on custom scripts', async () => {
548+
let inspectPayload = ''
549+
dynamicAppPort = await findPort()
550+
ampDynamic = await launchApp(join(__dirname, '../'), dynamicAppPort, {
551+
onStdout(msg) {
552+
inspectPayload += msg
553+
},
554+
onStderr(msg) {
555+
inspectPayload += msg
556+
},
557+
})
558+
559+
await renderViaHTTP(dynamicAppPort, '/custom-scripts')
560+
561+
await killApp(ampDynamic)
562+
563+
expect(inspectPayload).toContain('error')
564+
})
565+
539566
it('should not contain missing files warning', async () => {
540567
expect(output).toContain('Compiled /only-amp')
541568
expect(output).not.toContain('Could not find files for')

0 commit comments

Comments
 (0)