@@ -199,21 +199,41 @@ Deno.test("Path.prettyLocalString()", () => {
199199 assertEquals ( new Path ( "/a/b" ) . prettyLocalString ( ) , `${ root } a${ SEP } b` )
200200} )
201201
202- Deno . test ( "Path.readYAMLAll()" , ( ) => {
203- const path = Path . cwd ( ) . join ( "./fixtures/pathtests/readYAMLAll.yaml" )
204- path . readYAMLAll ( ) . then ( ( yamlData ) => {
205- assertEquals ( Array . isArray ( yamlData ) , true )
202+ Deno . test ( "Path.readYAMLAll()" , async ( ) => {
203+ const path = Path . cwd ( ) . join ( "./fixtures/pathtests/readYAMLAll.yaml" ) ;
204+
205+ try {
206+ const yamlData = await path . readYAMLAll ( ) ; // ✅ Use await
207+
208+ assertEquals ( Array . isArray ( yamlData ) , true , "Expected yamlData to be an array" ) ;
209+
206210 if ( ! Array . isArray ( yamlData ) ) {
207211 fail ( "Expected an array" ) ;
208212 return ;
209213 }
210- assertEquals ( yamlData . length , 2 )
211- assertEquals ( yamlData , [ { abc : "xyz" } , { ijk : "lmn" } ] ) ;
212- } ) . catch ( ( err ) => {
214+
215+ assertEquals ( yamlData . length , 2 , "Expected exactly 2 YAML documents" ) ;
216+ assertEquals ( yamlData , [ { abc : "xyz" } , { ijk : "lmn" } ] , "YAML content mismatch" ) ;
217+
218+ } catch ( err ) {
213219 console . error ( "Error reading YAML:" , err ) ;
214- fail ( "error reading YAML" , err ) ;
215- } )
216- } )
220+ fail ( "Error reading YAML" ) ;
221+ }
222+ } ) ;
223+
224+ Deno . test ( "Path.readYAMLAllErr()" , async ( ) => {
225+ const path = Path . cwd ( ) . join ( "./fixtures/pathtests/invalid.yaml" ) ;
226+ try {
227+ await path . readYAMLAll ( ) ;
228+ fail ( "invalid file should not reach here" )
229+ } catch ( err ) {
230+ if ( err instanceof Error ) {
231+ assertEquals ( err . name , "NotFound" )
232+ } else {
233+ throw err ;
234+ }
235+ }
236+ } ) ;
217237
218238Deno . test ( "Path.chuzzle()" , ( ) => {
219239 const path = Path . mktemp ( ) . join ( "file.txt" ) . touch ( )
0 commit comments