project-nomad/admin/tests/unit/custom_url.spec.ts
2026-09-29 15:54:41 -07:00

16 lines
571 B
TypeScript

import * as assert from 'node:assert/strict'
import { test } from 'node:test'
import { normalizeCustomUrl } from '../../app/validators/system.js'
test('rejects a normalized custom URL that exceeds the database column size', () => {
const tooLongHost = 'a'.repeat(247)
assert.equal(normalizeCustomUrl(`https://${tooLongHost}`), null)
})
test('accepts a normalized custom URL at the database column limit', () => {
const maxLengthHost = 'a'.repeat(246)
const normalized = normalizeCustomUrl(`https://${maxLengthHost}`)
assert.equal(normalized?.length, 255)
})