Skip to content

Commit

Permalink
Add tests ensuring auto-exported amphtml rel is valid (#9762)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Dec 16, 2019
1 parent 2ba056a commit 87d9b2e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/integration/amphtml/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
5 changes: 5 additions & 0 deletions test/integration/serverless-trace/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions test/integration/serverless/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 87d9b2e

Please sign in to comment.