补强分享元数据与版本一致性检查
This commit was merged in pull request #1.
This commit is contained in:
@@ -154,13 +154,15 @@ describe('application branding assets', () => {
|
||||
|
||||
it('declares one product description for standard and Open Graph consumers without a custom image', async () => {
|
||||
const html = (await readProjectFile('index.html')).toString('utf8')
|
||||
const socialMetadata = [...html.matchAll(/<meta\s+(?:name|property)="((?:og|twitter):[^"]+)"/gi)]
|
||||
.map((match) => match[1].toLowerCase())
|
||||
|
||||
expect(html).toContain('<meta name="description" content="一个匿名访问、自托管的浏览器本地工具箱" />')
|
||||
expect(html).toContain('<meta property="og:description" content="一个匿名访问、自托管的浏览器本地工具箱" />')
|
||||
expect(html.match(/一个匿名访问、自托管的浏览器本地工具箱/g)).toHaveLength(2)
|
||||
expect(socialMetadata).toEqual(['og:description'])
|
||||
expect(html).not.toContain('share-preview.png')
|
||||
expect(html).not.toMatch(/(?:name|property)="(?:og|twitter):[^\"]*image/i)
|
||||
expect(html).not.toMatch(/(?:name|property)="twitter:/i)
|
||||
await expect(access(path.join(publicRoot, 'share-preview.png'))).rejects.toMatchObject({ code: 'ENOENT' })
|
||||
})
|
||||
|
||||
it('includes public assets in container builds', async () => {
|
||||
|
||||
Reference in New Issue
Block a user