-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsite-regression.test.mjs
More file actions
77 lines (62 loc) · 3.33 KB
/
site-regression.test.mjs
File metadata and controls
77 lines (62 loc) · 3.33 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import test from 'node:test';
import yaml from 'js-yaml';
const root = process.cwd();
function read(file) {
return fs.readFileSync(path.join(root, file), 'utf8');
}
function exists(file) {
return fs.existsSync(path.join(root, file));
}
function loadPresentations() {
const raw = read('_data/presentations.yml');
const parsed = yaml.load(raw);
assert.ok(Array.isArray(parsed), '_data/presentations.yml must be a YAML array');
return parsed;
}
test('homepage keeps critical identity content', () => {
const index = read('index.md');
assert.match(index, /DEGODEZ Sébastien/i, 'Missing main identity heading');
assert.match(index, /Software Engineer.+AXA France/i, 'Missing current role');
assert.match(index, /Brag Document/i, 'Missing Brag Document CTA');
assert.match(index, /LinkedIn/i, 'Missing LinkedIn link');
assert.match(index, /HVE/i, 'Missing HVE phase explanation');
assert.match(index, /BRD/i, 'Missing BRD phase explanation');
assert.match(index, /PRD/i, 'Missing PRD phase explanation');
assert.match(index, /High Value Exploration/i, 'Missing HVE long-form explanation');
assert.match(index, /Business Requirements Document/i, 'Missing BRD long-form explanation');
assert.match(index, /Product Requirements Document/i, 'Missing PRD long-form explanation');
assert.match(index, /Agents & Skills/i, 'Missing agents and skills section');
});
test('layout keeps navigation shell and design tokens', () => {
const layout = read('_layouts/default.html');
assert.match(layout, /<nav class="site-nav"/i, 'Top navigation shell should exist');
assert.match(layout, /design-tokens\.css/i, 'Design tokens stylesheet should stay wired');
assert.match(layout, /\{\{\s*content\s*\}\}/i, 'Layout should render page content');
});
test('presentations catalog page keeps data-driven loop', () => {
const page = read('presentations.md');
assert.match(page, /for presentation in site\.data\.presentations/i, 'Catalog must remain data-driven from presentations.yml');
assert.match(page, /project-card/i, 'Presentation card markup should exist');
assert.match(page, /presentations-catalog\.html/i, 'Catalog permalink should stay stable');
});
test('presentations data file is valid and points to existing published files', () => {
const items = loadPresentations();
assert.ok(items.length > 0, 'At least one presentation should be published');
for (const [index, item] of items.entries()) {
const prefix = `Entry #${index + 1}`;
assert.ok(item.id, `${prefix}: missing id`);
assert.ok(item.title, `${prefix}: missing title`);
assert.ok(item.project, `${prefix}: missing project`);
assert.ok(item.source_repository, `${prefix}: missing source_repository`);
assert.ok(item.source_path, `${prefix}: missing source_path`);
assert.ok(Object.hasOwn(item, 'updated_at'), `${prefix}: missing updated_at`);
assert.ok(Object.hasOwn(item, 'source_commit'), `${prefix}: missing source_commit`);
assert.ok(item.url, `${prefix}: missing url`);
assert.match(item.url, /^\/presentations\/.+\/$/, `${prefix}: url must target /presentations/<id>/`);
const relativeTarget = item.url.replace(/^\//, '') + 'index.html';
assert.ok(exists(relativeTarget), `${prefix}: published file does not exist (${relativeTarget})`);
}
});