brendmanager/test/visual.test.js

25 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test } from 'node:test';
import assert from 'node:assert/strict';
import { existsSync, readFileSync } from 'node:fs';
import { C, contrast } from '../design/brand-visual/build.mjs';
test('Основной текст читается: контраст не ниже 4,5', () => {
for (const [a, b] of [['graphite', 'milk'], ['navy', 'milk'], ['terracotta', 'milk'], ['milk', 'navy']]) {
assert.ok(contrast(C[a], C[b]) >= 4.5, `${a} на ${b}`);
}
});
test('Образцы на месте: 4 вида × 2 варианта, PNG и SVG', () => {
for (const n of ['telegram-post', 'telegram-cover', 'linkedin-post', 'linkedin-cover']) {
for (const v of ['plain', 'photo']) {
for (const e of ['png', 'svg']) assert.ok(existsSync(`design/brand-visual/${n}-${v}.${e}`), `${n}-${v}.${e}`);
}
}
});
test('Пока нет согласования Татьяны — статус «черновик»', () => {
const d = readFileSync('docs/visual-system.md', 'utf8');
assert.match(d, /Статус: черновик/);
assert.match(d, /Дата согласования: —/);
});