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

This commit is contained in:
JJ Kasper 2019-12-16 11:32:35 -06:00 committed by GitHub
parent 2ba056aa20
commit 87d9b2e03e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View file

@ -151,6 +151,11 @@ describe('AMP Usage', () => {
).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 () => {
const html = await renderViaHTTP(appPort, '/use-amp-hook?hello=1')
expect(html).not.toMatch(/&amp=1/)

View file

@ -76,6 +76,11 @@ describe('Serverless Trace', () => {
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 () => {
const url = `http://localhost:${appPort}/fetch`
const res = await fetch(url)

View file

@ -117,6 +117,11 @@ describe('Serverless', () => {
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 () => {
const url = `http://localhost:${appPort}/fetch`
const res = await fetch(url)