Download tools/ui/tests/unit/redact.test.ts from Brunobkr/llama.cpp_AlgMor24_github: direct link, hf CLI and curl.
- Browser
- Download file 606 Bytes
-
https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github/resolve/main/tools/ui/tests/unit/redact.test.ts
- Command line
-
hf download hf://datasets/Brunobkr/llama.cpp_AlgMor24_github/tools/ui/tests/unit/redact.test.ts
-
curl -L -o redact.test.ts https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github/resolve/main/tools/ui/tests/unit/redact.test.ts
606 Bytes
| import { redactValue } from '$lib/utils/redact'; | |
| import { describe, expect, it } from 'vitest'; | |
| describe('redactValue', () => { | |
| it('returns [redacted] by default', () => { | |
| expect(redactValue('secret-token')).toBe('[redacted]'); | |
| }); | |
| it('shows last N characters when showLastChars is provided', () => { | |
| expect(redactValue('session-abc12', 5)).toBe('....abc12'); | |
| }); | |
| it('handles value shorter than showLastChars', () => { | |
| expect(redactValue('ab', 5)).toBe('....ab'); | |
| }); | |
| it('returns [redacted] when showLastChars is 0', () => { | |
| expect(redactValue('secret', 0)).toBe('[redacted]'); | |
| }); | |
| }); | |