feat(blocking): определять и показывать хостер в матрице блокировок
Docker / build (push) Failing after 26s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-08-25 13:19:02 +07:00
co-authored by Cursor
parent efebcaf16d
commit 60a22b9450
15 changed files with 273 additions and 13 deletions
@@ -0,0 +1,21 @@
import { describe, expect, it } from 'vitest'
import { canonicalizeHoster } from '@cfdm/shared/contracts/censorcheck'
describe('canonicalizeHoster', () => {
it('мапит ASN/org на короткое имя', () => {
expect(canonicalizeHoster('AS14061 DigitalOcean, LLC')).toBe('DigitalOcean')
expect(canonicalizeHoster('Hetzner Online GmbH')).toBe('Hetzner')
expect(canonicalizeHoster('hosted-by.vdsina.ru')).toBe('VDSina')
expect(canonicalizeHoster(' aeza.net. ')).toBe('Aeza')
})
it('пустую строку отбрасывает', () => {
expect(canonicalizeHoster('')).toBeNull()
expect(canonicalizeHoster(' ')).toBeNull()
expect(canonicalizeHoster(undefined)).toBeNull()
})
it('неизвестную org чистит без alias', () => {
expect(canonicalizeHoster('AS12345 Example Hosting LLC')).toBe('Example Hosting')
})
})