test(placeholder): add static-content tests for under-construction page
This commit is contained in:
72
src/placeholder.test.ts
Normal file
72
src/placeholder.test.ts
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import { existsSync, readFileSync } from 'node:fs';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
|
const placeholderDir = join(process.cwd(), 'placeholder');
|
||||||
|
const indexPath = join(placeholderDir, 'index.html');
|
||||||
|
|
||||||
|
describe('placeholder/index.html', () => {
|
||||||
|
const html = readFileSync(indexPath, 'utf8');
|
||||||
|
|
||||||
|
it('starts with the HTML5 doctype', () => {
|
||||||
|
expect(html.toLowerCase().trimStart()).toMatch(/^<!doctype html>/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has the back-shortly title', () => {
|
||||||
|
expect(html).toContain('<title>Cameleer — Back shortly</title>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('is not indexable by search engines', () => {
|
||||||
|
expect(html).toContain('<meta name="robots" content="noindex">');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('declares the dark color-scheme matching the live site', () => {
|
||||||
|
expect(html).toContain('<meta name="color-scheme" content="dark">');
|
||||||
|
expect(html).toContain('<meta name="theme-color" content="#060a13">');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('contains the sentinel string the deploy workflow greps for', () => {
|
||||||
|
// The workflow's post-deploy smoke test fails if this string is missing.
|
||||||
|
expect(html).toContain('Routes are remapping');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('uses the live hero subhead verbatim', () => {
|
||||||
|
expect(html).toContain(
|
||||||
|
'Cameleer is the hosted runtime and observability platform for Apache Camel — auto-traced, replay-ready, cross-service correlated. The 3 AM page becomes a 30-second answer.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('contains __SALES_EMAIL__ tokens at both the mailto href and the link text', () => {
|
||||||
|
const matches = html.match(/__SALES_EMAIL__/g) ?? [];
|
||||||
|
expect(matches.length).toBeGreaterThanOrEqual(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('contains no other __TOKEN__ style placeholders', () => {
|
||||||
|
// Guard against a forgotten token that would survive the sed substitution.
|
||||||
|
const allTokens = html.match(/__[A-Z][A-Z0-9_]+__/g) ?? [];
|
||||||
|
const nonSales = allTokens.filter((t) => t !== '__SALES_EMAIL__');
|
||||||
|
expect(nonSales).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('references the sibling cameleer-logo.png by relative path', () => {
|
||||||
|
expect(html).toContain('src="./cameleer-logo.png"');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('references the sibling favicon.png by relative path', () => {
|
||||||
|
expect(html).toContain('href="./favicon.png"');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('has no <script> tags (placeholder must work without JS)', () => {
|
||||||
|
expect(html).not.toMatch(/<script[\s>]/i);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('placeholder/ asset siblings', () => {
|
||||||
|
it('cameleer-logo.png exists on disk', () => {
|
||||||
|
expect(existsSync(join(placeholderDir, 'cameleer-logo.png'))).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('favicon.png exists on disk', () => {
|
||||||
|
expect(existsSync(join(placeholderDir, 'favicon.png'))).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user