/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/stores/tests/chat.test.ts
21 строка
955 B
chrisnojima-zoom
Version 670 - clean2 (#29122)
08 июн 2026, 19:31
Не верифицирован
08 июн 2026, 19:31
1943197
Код
Авторство
О чём код?
/// <reference types="jest" /> import {clampImageSize, getTeamMentionName, isAssertion, zoomImage} from '@/constants/chat/helpers' test('chat helper utilities derive stable defaults and formatting', () => { expect(getTeamMentionName('acme', 'general')).toBe('acme#general') expect(getTeamMentionName('acme', '')).toBe('acme') expect(isAssertion('alice@twitter')).toBe(true) expect(isAssertion('alice')).toBe(false) }) test('chat sizing helpers clamp and center oversized images', () => { expect(clampImageSize(1200, 600, 400, 300)).toEqual({height: 200, width: 400}) expect(clampImageSize(500, 1200, 400, 300)).toEqual({height: 300, width: 125}) const zoomed = zoomImage(50, 100, 40) expect(zoomed.dims).toEqual({height: 80, width: 40}) expect(zoomed.margins.marginTop).toBe(-20) expect(zoomed.margins.marginBottom).toBe(-20) expect(zoomed.margins.marginLeft).toBeCloseTo(0) expect(zoomed.margins.marginRight).toBeCloseTo(0) })