Unverified Commit 87d9b2e0 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Add tests ensuring auto-exported amphtml rel is valid (#9762)

parent 2ba056aa
...@@ -151,6 +151,11 @@ describe('AMP Usage', () => { ...@@ -151,6 +151,11 @@ describe('AMP Usage', () => {
).toBe('http://localhost:1234/use-amp-hook.amp') ).toBe('http://localhost:1234/use-amp-hook.amp')
}) })
it('should render amphtml from provided rel link', async () => {
const html = await renderViaHTTP(appPort, '/use-amp-hook.amp')
await validateAMP(html)
})
it('should render link rel amphtml with existing query', async () => { it('should render link rel amphtml with existing query', async () => {
const html = await renderViaHTTP(appPort, '/use-amp-hook?hello=1') const html = await renderViaHTTP(appPort, '/use-amp-hook?hello=1')
expect(html).not.toMatch(/&amp=1/) expect(html).not.toMatch(/&amp=1/)
......
...@@ -76,6 +76,11 @@ describe('Serverless Trace', () => { ...@@ -76,6 +76,11 @@ describe('Serverless Trace', () => {
expect(html).toMatch(/rel="canonical" href="\/some-amp"/) expect(html).toMatch(/rel="canonical" href="\/some-amp"/)
}) })
it('should have correct canonical link (auto-export link)', async () => {
const html = await renderViaHTTP(appPort, '/some-amp.amp')
expect(html).toMatch(/rel="canonical" href="\/some-amp"/)
})
it('should render correctly when importing isomorphic-unfetch', async () => { it('should render correctly when importing isomorphic-unfetch', async () => {
const url = `http://localhost:${appPort}/fetch` const url = `http://localhost:${appPort}/fetch`
const res = await fetch(url) const res = await fetch(url)
......
...@@ -117,6 +117,11 @@ describe('Serverless', () => { ...@@ -117,6 +117,11 @@ describe('Serverless', () => {
expect(html).toMatch(/rel="canonical" href="\/some-amp"/) expect(html).toMatch(/rel="canonical" href="\/some-amp"/)
}) })
it('should have correct canonical link (auto-export link)', async () => {
const html = await renderViaHTTP(appPort, '/some-amp.amp')
expect(html).toMatch(/rel="canonical" href="\/some-amp"/)
})
it('should render correctly when importing isomorphic-unfetch', async () => { it('should render correctly when importing isomorphic-unfetch', async () => {
const url = `http://localhost:${appPort}/fetch` const url = `http://localhost:${appPort}/fetch`
const res = await fetch(url) const res = await fetch(url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment