Preview: Block ausserhalb des Formulars, Validierung und Feinschliff
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2de846436b
commit
c1818fadcf
6 files changed
+62
-22
No files matched your search
@@ -2,7 +2,7 @@ import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { loadModule } from './load.mjs'
|
||||
|
||||
const { isValidEnvName, buildEnvPayload, dotColor, isDevPreview } = await loadModule('src/lib/previewEnv.js')
|
||||
const { isValidEnvName, buildEnvPayload, dotColor, isDevPreview, envValueTooLong, MAX_ENV_VARS } = await loadModule('src/lib/previewEnv.js')
|
||||
|
||||
test('isValidEnvName', () => {
|
||||
assert.equal(isValidEnvName('VITE_API_URL'), true)
|
||||
@@ -35,3 +35,10 @@ test('isDevPreview', () => {
|
||||
assert.equal(isDevPreview({ mode: 'build', detected: 'dev:npm' }), false)
|
||||
assert.equal(isDevPreview(null), false)
|
||||
})
|
||||
|
||||
test('envValueTooLong zählt Bytes', () => {
|
||||
assert.equal(envValueTooLong('a'.repeat(4096)), false)
|
||||
assert.equal(envValueTooLong('a'.repeat(4097)), true)
|
||||
assert.equal(envValueTooLong('ä'.repeat(2049)), true)
|
||||
assert.equal(MAX_ENV_VARS, 30)
|
||||
})
|
||||
Reference in new issue
Block a user