summaryrefslogtreecommitdiffstats
path: root/tests/humans.spec.js
blob: 2acf7e029e025875176a000a5125a72cd77d4a22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';

// @ts-check
const { test, expect } = require('@playwright/test');

test('humans.txt contains expected information', async ({ page }) => {
  await page.goto('/humans.txt');

  // Get the content of the page
  const content = await page.content();

  // Define the expected fields
  const expectedFields = [
    'Author:',
    'Contact:',
    'GitHub:',
    'Twitter:',
    'From:',
    'Last update:',
    'Language:',
    'Doctype:',
    'Standards:',
    'Components:',
    'Hugo version:'
  ];

  // Check if each expected field is present in the content
  for (const field of expectedFields) {
    expect(content).toContain(field);
  }

  // Check if the content contains non-empty values for each field
  for (const field of expectedFields) {
    const regex = new RegExp(`${field}\\s+(.+)`, 'g');
    const match = regex.exec(content);
    expect(match).not.toBeNull();
    expect(match[1].trim()).not.toBe('');
  }
});