@@ -5,7 +5,6 @@ describe("URLSpec Builder", () => {
55 it ( "should build basic spec" , ( ) => {
66 const spec = new URLSpec ( ) ;
77
8- spec . setNamespace ( "jobs" ) ;
98 spec . addPage ( {
109 name : "list" ,
1110 path : "/jobs" ,
@@ -14,15 +13,13 @@ describe("URLSpec Builder", () => {
1413
1514 const result = spec . toString ( ) ;
1615
17- expect ( result ) . toContain ( "namespace jobs;" ) ;
1816 expect ( result ) . toContain ( "page list = /jobs {" ) ;
1917 expect ( result ) . toContain ( "category?: string;" ) ;
2018 } ) ;
2119
2220 it ( "should build with param types" , ( ) => {
2321 const spec = new URLSpec ( ) ;
2422
25- spec . setNamespace ( "jobs" ) ;
2623 spec . addParamType ( "sortOrder" , [ "recent" , "popular" , "trending" ] ) ;
2724 spec . addPage ( {
2825 name : "list" ,
@@ -41,7 +38,6 @@ describe("URLSpec Builder", () => {
4138 it ( "should build with global parameters" , ( ) => {
4239 const spec = new URLSpec ( ) ;
4340
44- spec . setNamespace ( "jobs" ) ;
4541 spec . addGlobalParam ( {
4642 name : "utm_source" ,
4743 type : "string" ,
@@ -58,29 +54,24 @@ describe("URLSpec Builder", () => {
5854 expect ( result ) . toContain ( "utm_source?: string;" ) ;
5955 } ) ;
6056
61- it ( "should build with endpoint" , ( ) => {
57+ it ( "should build without namespace and endpoint" , ( ) => {
6258 const spec = new URLSpec ( ) ;
6359
64- spec . setNamespace ( "jobs" ) ;
65- spec . setEndpoint ( "https://api.example.com" ) ;
6660 spec . addPage ( {
6761 name : "list" ,
6862 path : "/jobs" ,
6963 } ) ;
7064
7165 const result = spec . toString ( ) ;
7266
73- expect ( result ) . toContain ( "namespace jobs; " ) ;
74- expect ( result ) . toContain ( ' endpoint "https://api.example.com";' ) ;
67+ expect ( result ) . not . toContain ( "namespace" ) ;
68+ expect ( result ) . not . toContain ( " endpoint" ) ;
7569 expect ( result ) . toContain ( "page list = /jobs {" ) ;
7670 } ) ;
7771
7872 it ( "should build complete example" , ( ) => {
7973 const spec = new URLSpec ( ) ;
8074
81- spec . setNamespace ( "jobs" ) ;
82- spec . setEndpoint ( "https://api.example.com" ) ;
83-
8475 spec . addParamType ( "sortOrder" , [ "recent" , "popular" , "trending" ] ) ;
8576 spec . addParamType ( "jobStatus" , [ "active" , "closed" , "draft" ] ) ;
8677
@@ -111,8 +102,6 @@ describe("URLSpec Builder", () => {
111102
112103 const result = spec . toString ( ) ;
113104
114- expect ( result ) . toContain ( "namespace jobs;" ) ;
115- expect ( result ) . toContain ( 'endpoint "https://api.example.com";' ) ;
116105 expect ( result ) . toContain ( "param sortOrder" ) ;
117106 expect ( result ) . toContain ( "param jobStatus" ) ;
118107 expect ( result ) . toContain ( "global {" ) ;
@@ -123,8 +112,6 @@ describe("URLSpec Builder", () => {
123112 it ( "should support dynamic page generation" , ( ) => {
124113 const spec = new URLSpec ( ) ;
125114
126- spec . setNamespace ( "jobs" ) ;
127-
128115 const statuses = [ "pending" , "approved" , "rejected" ] ;
129116 for ( const status of statuses ) {
130117 spec . addPage ( {
@@ -144,7 +131,6 @@ describe("URLSpec Builder", () => {
144131 describe ( "Security - Path Traversal Prevention" , ( ) => {
145132 it ( "should reject paths with .. traversal sequences" , async ( ) => {
146133 const spec = new URLSpec ( ) ;
147- spec . setNamespace ( "test" ) ;
148134
149135 await expect ( spec . writeFile ( "../../../etc/passwd" ) ) . rejects . toThrow (
150136 "path traversal detected" ,
@@ -153,7 +139,6 @@ describe("URLSpec Builder", () => {
153139
154140 it ( "should reject paths to sensitive system directories" , async ( ) => {
155141 const spec = new URLSpec ( ) ;
156- spec . setNamespace ( "test" ) ;
157142
158143 await expect ( spec . writeFile ( "/etc/hosts" ) ) . rejects . toThrow (
159144 "cannot write to sensitive directory" ,
@@ -174,7 +159,6 @@ describe("URLSpec Builder", () => {
174159
175160 it ( "should reject paths outside allowed base directory" , async ( ) => {
176161 const spec = new URLSpec ( ) ;
177- spec . setNamespace ( "test" ) ;
178162
179163 await expect (
180164 spec . writeFile ( "/tmp/test.urlspec" , { allowedBaseDir : "/home/user" } ) ,
@@ -183,7 +167,6 @@ describe("URLSpec Builder", () => {
183167
184168 it ( "should allow valid paths within allowed base directory" , async ( ) => {
185169 const spec = new URLSpec ( ) ;
186- spec . setNamespace ( "test" ) ;
187170 spec . addPage ( { name : "home" , path : "/" } ) ;
188171
189172 // This should not throw (but will fail to write without proper setup)
@@ -196,7 +179,6 @@ describe("URLSpec Builder", () => {
196179
197180 it ( "should normalize paths before validation" , async ( ) => {
198181 const spec = new URLSpec ( ) ;
199- spec . setNamespace ( "test" ) ;
200182
201183 // These should be rejected even with path obfuscation
202184 await expect ( spec . writeFile ( "/tmp/../etc/passwd" ) ) . rejects . toThrow ( ) ;
0 commit comments