@@ -16,9 +16,8 @@ chai.use(require('chai-things'));
1616const sinon = require ( 'sinon' ) ;
1717const rewire = require ( 'rewire' ) ;
1818
19- const fs = require ( 'fs-extra' ) ;
2019const mockery = require ( 'mockery' ) ;
21- const path = require ( 'path' ) ;
20+ const path = require ( 'node: path' ) ;
2221
2322// class under test
2423const pathToRoot = '../../../..' ;
@@ -81,7 +80,7 @@ describe('bootstrap.js', () => {
8180 mockery . registerMock ( '../cmds/startCommand.js' , mockCmd ) ;
8281 mockery . registerMock ( '../cmds/serverCommand.js' , mockCmd ) ;
8382 mockery . registerMock ( './chaincodefromcontract' , MockChaincodeFromContract ) ;
84- mockery . registerMock ( 'fs-extra ' , { pathExists : pathExistsStub , readFileSync : readFileStub } ) ;
83+ mockery . registerMock ( 'node:fs ' , { promises : { access : pathExistsStub } , readFileSync : readFileStub } ) ;
8584
8685 Bootstrap = rewire ( path . join ( pathToRoot , 'fabric-shim/lib/contract-spi/bootstrap' ) ) ;
8786 } ) ;
@@ -293,7 +292,7 @@ describe('bootstrap.js', () => {
293292 describe ( '#getMetadata' , ( ) => {
294293
295294 it ( 'should handle when there are files available in META-INF dir' , async ( ) => {
296- pathExistsStub . returns ( true ) ;
295+ pathExistsStub . resolves ( ) ;
297296 Bootstrap . loadAndValidateMetadata = sandbox . stub ( ) . resolves ( { 'hello' :'world' } ) ;
298297
299298 const metadata = await Bootstrap . getMetadata ( 'fake path' ) ;
@@ -303,8 +302,8 @@ describe('bootstrap.js', () => {
303302 } ) ;
304303
305304 it ( 'should handle when there are files available in contract-metadata dir' , async ( ) => {
306- pathExistsStub . onFirstCall ( ) . returns ( false ) ;
307- pathExistsStub . onSecondCall ( ) . returns ( true ) ;
305+ pathExistsStub . onFirstCall ( ) . rejects ( ) ;
306+ pathExistsStub . onSecondCall ( ) . resolves ( ) ;
308307 Bootstrap . loadAndValidateMetadata = sandbox . stub ( ) . resolves ( { 'hello' :'world' } ) ;
309308
310309 const metadata = await Bootstrap . getMetadata ( 'fake path' ) ;
@@ -314,7 +313,7 @@ describe('bootstrap.js', () => {
314313 } ) ;
315314
316315 it ( 'should handle when files not available' , async ( ) => {
317- pathExistsStub . returns ( false ) ;
316+ pathExistsStub . rejects ( ) ;
318317
319318 const metadata = await Bootstrap . getMetadata ( 'fake path' ) ;
320319
0 commit comments