mirror of
https://github.com/kremalicious/blog.git
synced 2025-01-08 20:55:45 +01:00
31 lines
979 B
TypeScript
31 lines
979 B
TypeScript
|
import { test, expect } from '@playwright/test'
|
||
|
import siteConfig from '@config/blog.config'
|
||
|
|
||
|
const postSlug = 'gatsby-redirect-from'
|
||
|
const canonical = `${siteConfig.siteUrl}/${postSlug}`
|
||
|
|
||
|
test.beforeEach(async ({ page }) => {
|
||
|
await page.goto(`/${postSlug}`)
|
||
|
})
|
||
|
|
||
|
test('meta is correct', async ({ page }) => {
|
||
|
await expect(page).toHaveTitle(/Redirect plugin for Markdown Pages in Gatsby/)
|
||
|
|
||
|
await expect(page.locator('meta[property="og:title"]')).toHaveAttribute(
|
||
|
'content',
|
||
|
/Redirect plugin for Markdown Pages in Gatsby/
|
||
|
)
|
||
|
await expect(page.locator('link[rel="canonical"]')).toHaveAttribute(
|
||
|
'href',
|
||
|
canonical
|
||
|
)
|
||
|
await expect(page.locator('meta[property="og:url"]')).toHaveAttribute(
|
||
|
'content',
|
||
|
canonical
|
||
|
)
|
||
|
await expect(page.locator('meta[name="description"]')).toHaveAttribute(
|
||
|
'content',
|
||
|
'Plugin for Gatsby to create redirects based on a list in your Markdown frontmatter, mimicking the behavior of jekyll-redirect-from.'
|
||
|
)
|
||
|
})
|