22import { mockFsWithUnionfs } from '@sap-cloud-sdk/test-util-internal/fs-mocker' ;
33mockFsWithUnionfs ( jest ) ;
44import { join , resolve } from 'path' ;
5- import { readFile } from 'fs/promises' ;
5+ import { readFile , readdir } from 'fs/promises' ;
66import { jest } from '@jest/globals' ;
77import { transports } from 'winston' ;
88import { vol } from 'memfs' ;
@@ -47,6 +47,10 @@ describe('generator', () => {
4747 } ,
4848 process . cwd ( )
4949 ) ;
50+ vol . mkdirSync ( pathTestServiceDir , { recursive : true } ) ;
51+ vol . mkdirSync ( join ( pathTestServiceDir , 'sdk-metadata' ) , {
52+ recursive : true
53+ } ) ;
5054 vol . fromNestedJSON ( { '.keep' : '' } , pathTestServiceDir ) ;
5155
5256 const options = createOptions ( {
@@ -126,7 +130,7 @@ describe('generator', () => {
126130 } ) ;
127131
128132 it ( 'copies the additional files matching the glob.' , async ( ) => {
129- const sourceFiles = await promises . readdir (
133+ const sourceFiles = await readdir (
130134 join ( 'common' , 'API_TEST_SRV' )
131135 ) ;
132136
@@ -136,14 +140,14 @@ describe('generator', () => {
136140 } ) ;
137141
138142 it ( 'generates the options per service and writes to the given folder' , async ( ) => {
139- const clientFile = await promises . readFile (
143+ const clientFile = await readFile (
140144 'someDir/test-service-options.json'
141145 ) ;
142146 expect ( clientFile ) . toBeDefined ( ) ;
143147 } , 10000 ) ;
144148
145149 it ( 'generates the api hub metadata and writes to the input folder' , async ( ) => {
146- const sourceFiles = await promises . readdir (
150+ const sourceFiles = await readdir (
147151 join ( pathTestService , '../sdk-metadata' )
148152 ) ;
149153 const clientFile = sourceFiles . find (
@@ -477,10 +481,15 @@ describe('generator', () => {
477481 vol . fromNestedJSON (
478482 {
479483 common : { '.keep' : '' } ,
484+ logger : { API_TEST_SRV : { '.keep' : '' } } ,
480485 '/prettier/config' : JSON . stringify ( { printWidth : 66 } )
481486 } ,
482487 process . cwd ( )
483488 ) ;
489+ vol . mkdirSync ( pathTestServiceDir , { recursive : true } ) ;
490+ vol . mkdirSync ( join ( pathTestServiceDir , 'sdk-metadata' ) , {
491+ recursive : true
492+ } ) ;
484493 vol . fromNestedJSON ( { '.keep' : '' } , pathTestServiceDir ) ;
485494 } ) ;
486495
0 commit comments