11import { describe , expect , it } from "vitest" ;
22import { AtlasArgs , CommonArgs } from "../../src/tools/args.js" ;
33
4- describe ( "Atlas Validators " , ( ) => {
4+ describe ( "Tool args " , ( ) => {
55 describe ( "CommonArgs" , ( ) => {
66 describe ( "string" , ( ) => {
77 it ( "should return a ZodString schema" , ( ) => {
@@ -19,9 +19,24 @@ describe("Atlas Validators", () => {
1919
2020 it ( "should not allow special characters and unicode symbols" , ( ) => {
2121 const schema = CommonArgs . string ( ) ;
22+
23+ // Unicode characters
2224 expect ( ( ) => schema . parse ( "héllo" ) ) . toThrow ( ) ;
2325 expect ( ( ) => schema . parse ( "测试" ) ) . toThrow ( ) ;
26+ expect ( ( ) => schema . parse ( "café" ) ) . toThrow ( ) ;
27+
28+ // Emojis
2429 expect ( ( ) => schema . parse ( "🚀" ) ) . toThrow ( ) ;
30+ expect ( ( ) => schema . parse ( "hello😀" ) ) . toThrow ( ) ;
31+
32+ // Control characters (below ASCII 32)
33+ expect ( ( ) => schema . parse ( "hello\nworld" ) ) . toThrow ( ) ;
34+ expect ( ( ) => schema . parse ( "hello\tworld" ) ) . toThrow ( ) ;
35+ expect ( ( ) => schema . parse ( "hello\0world" ) ) . toThrow ( ) ;
36+
37+ // Extended ASCII characters (above ASCII 126)
38+ expect ( ( ) => schema . parse ( "hello\x80" ) ) . toThrow ( ) ;
39+ expect ( ( ) => schema . parse ( "hello\xFF" ) ) . toThrow ( ) ;
2540 } ) ;
2641
2742 it ( "should reject non-string values" , ( ) => {
@@ -246,9 +261,22 @@ describe("Atlas Validators", () => {
246261 } ) ;
247262 } ) ;
248263
264+ it ( "should accept exactly 50 characters" , ( ) => {
265+ const schema = AtlasArgs . region ( ) ;
266+ const maxLengthRegion = "a" . repeat ( 50 ) ;
267+ expect ( schema . parse ( maxLengthRegion ) ) . toBe ( maxLengthRegion ) ;
268+ } ) ;
269+
249270 it ( "should reject invalid region names" , ( ) => {
250271 const schema = AtlasArgs . region ( ) ;
251272
273+ // Empty string
274+ expect ( ( ) => schema . parse ( "" ) ) . toThrow ( "Region is required" ) ;
275+
276+ // Too long (over 50 characters)
277+ const longRegion = "a" . repeat ( 51 ) ;
278+ expect ( ( ) => schema . parse ( longRegion ) ) . toThrow ( "Region must be 50 characters or less" ) ;
279+
252280 // Invalid characters
253281 expect ( ( ) => schema . parse ( "US EAST 1" ) ) . toThrow (
254282 "Region can only contain letters, numbers, hyphens, and underscores"
0 commit comments