summaryrefslogtreecommitdiffstats
path: root/tests/humans.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/humans.spec.js')
-rw-r--r--tests/humans.spec.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/humans.spec.js b/tests/humans.spec.js
new file mode 100644
index 0000000..2acf7e0
--- /dev/null
+++ b/tests/humans.spec.js
@@ -0,0 +1,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('');
+ }
+});