@@ -140,27 +140,24 @@ describe('[#21476] a public form that cannot take intake on this posture is not
140140 expect ( [ postStatus , JSON . parse ( postBody ) . code ] ) . toEqual ( [ 404 , 'FORM_NOT_FOUND' ] ) ;
141141 } ) ;
142142
143- for ( const posture of [ 'isolated' , 'group' ] as const ) {
144- it ( `walled ('${ posture } '), walled object: both doors answer the withdrawn form's answer byte for byte, nothing is written` , async ( ) => {
145- const s = build ( { tenancy : posture } ) ;
146- expect ( answer ( await s . get ( ) ) ) . toEqual ( await withdrawnAnswer ( 'get' ) ) ;
147- expect ( answer ( await s . post ( ) ) ) . toEqual ( await withdrawnAnswer ( 'post' ) ) ;
148- expect ( s . createData ) . not . toHaveBeenCalled ( ) ;
149- } ) ;
150- }
151-
152- it ( 'ENUMERATION: every route under /forms/ is an anonymous form door, and each answers the withdrawn answer' , async ( ) => {
153- const s = build ( { tenancy : 'isolated' } ) ;
154- expect ( s . formDoors . map ( ( r ) => `${ r . method } ${ r . path } ` ) . sort ( ) ) . toEqual ( [
155- 'GET /api/v1/forms/:slug' ,
156- 'POST /api/v1/forms/:slug/submit' ,
157- ] ) ;
158- for ( const door of s . formDoors ) {
159- const expected = await withdrawnAnswer ( door . method === 'POST' ? 'post' : 'get' ) ;
160- expect ( answer ( await s . drive ( door , door . method ) ) , `${ door . method } ${ door . path } ` ) . toEqual ( expected ) ;
161- }
162- expect ( s . createData ) . not . toHaveBeenCalled ( ) ;
143+ // ENUMERATION: the doors are read off the registered routes, not listed by
144+ // hand, and each door × walled posture is its own row.
145+ const doors = build ( { tenancy : 'isolated' } ) . formDoors ;
146+ it ( 'ENUMERATION: the routes under /forms/ are exactly the two anonymous form doors' , ( ) => {
147+ expect ( doors . map ( ( r ) => `${ r . method } ${ r . path } ` ) . sort ( ) )
148+ . toEqual ( [ 'GET /api/v1/forms/:slug' , 'POST /api/v1/forms/:slug/submit' ] ) ;
163149 } ) ;
150+ for ( const door of doors ) {
151+ for ( const posture of [ 'isolated' , 'group' ] as const ) {
152+ it ( `${ door . method } ${ door . path } · '${ posture } ', walled object: the withdrawn form's answer byte for byte, nothing written` , async ( ) => {
153+ const s = build ( { tenancy : posture } ) ;
154+ const route = s . formDoors . find ( ( r ) => r . method === door . method && r . path === door . path ) ! ;
155+ const expected = await withdrawnAnswer ( door . method === 'POST' ? 'post' : 'get' ) ;
156+ expect ( answer ( await s . drive ( route , door . method ) ) ) . toEqual ( expected ) ;
157+ expect ( s . createData ) . not . toHaveBeenCalled ( ) ;
158+ } ) ;
159+ }
160+ }
164161
165162 it ( 'CONTROL: walled posture, object declared tenancy: { enabled: false } — accepted on both doors' , async ( ) => {
166163 const s = build ( { tenancy : 'isolated' , tenancyDisabled : true } ) ;
0 commit comments