diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2024-04-14 15:30:44 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2024-04-14 15:38:50 +0200 |
| commit | 23d77288040ca113dbc797aa2eaff6ba2a32f324 (patch) | |
| tree | c14a8417684dd54ea7425f7bc64d52d315973ad4 /tests/humans.spec.js | |
| parent | 77b73fceb49bff397dab6badb7df8e821960fe2b (diff) | |
| download | gohugo-theme-ed-23d77288040ca113dbc797aa2eaff6ba2a32f324.tar.gz | |
Move site author configuration to params
Diffstat (limited to 'tests/humans.spec.js')
| -rw-r--r-- | tests/humans.spec.js | 39 |
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(''); + } +}); |
