36 lines
1.7 KiB
JavaScript
36 lines
1.7 KiB
JavaScript
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, /Дата согласования: —/);
|
||
});
|
||
|
||
test('BRM-41: имя на обложках Telegram помещается целиком и не заходит на круг', async () => {
|
||
const { readFileSync } = await import('node:fs');
|
||
for (const v of ['plain', 'photo']) {
|
||
const svg = readFileSync(new URL(`../design/brand-visual/telegram-cover-${v}.svg`, import.meta.url), 'utf8');
|
||
const size = Number(/font-size="(\d+)"[^>]*>Татьяна Сайфарова</.exec(svg)[1]);
|
||
const right = 90 + size * 10;
|
||
const limit = v === 'photo' ? 1280 - 90 - 504 - 3 : 1280 - 40;
|
||
assert.ok(right < limit, `${v}: имя кончается на ${right}, предел ${limit}`);
|
||
}
|
||
});
|