@@ -16,9 +16,8 @@ chai.use(require('chai-things'));
16
16
const sinon = require ( 'sinon' ) ;
17
17
const rewire = require ( 'rewire' ) ;
18
18
19
- const fs = require ( 'fs-extra' ) ;
20
19
const mockery = require ( 'mockery' ) ;
21
- const path = require ( 'path' ) ;
20
+ const path = require ( 'node: path' ) ;
22
21
23
22
// class under test
24
23
const pathToRoot = '../../../..' ;
@@ -81,7 +80,7 @@ describe('bootstrap.js', () => {
81
80
mockery . registerMock ( '../cmds/startCommand.js' , mockCmd ) ;
82
81
mockery . registerMock ( '../cmds/serverCommand.js' , mockCmd ) ;
83
82
mockery . registerMock ( './chaincodefromcontract' , MockChaincodeFromContract ) ;
84
- mockery . registerMock ( 'fs-extra ' , { pathExists : pathExistsStub , readFileSync : readFileStub } ) ;
83
+ mockery . registerMock ( 'node:fs ' , { promises : { access : pathExistsStub } , readFileSync : readFileStub } ) ;
85
84
86
85
Bootstrap = rewire ( path . join ( pathToRoot , 'fabric-shim/lib/contract-spi/bootstrap' ) ) ;
87
86
} ) ;
@@ -293,7 +292,7 @@ describe('bootstrap.js', () => {
293
292
describe ( '#getMetadata' , ( ) => {
294
293
295
294
it ( 'should handle when there are files available in META-INF dir' , async ( ) => {
296
- pathExistsStub . returns ( true ) ;
295
+ pathExistsStub . resolves ( ) ;
297
296
Bootstrap . loadAndValidateMetadata = sandbox . stub ( ) . resolves ( { 'hello' :'world' } ) ;
298
297
299
298
const metadata = await Bootstrap . getMetadata ( 'fake path' ) ;
@@ -303,8 +302,8 @@ describe('bootstrap.js', () => {
303
302
} ) ;
304
303
305
304
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 ( ) ;
308
307
Bootstrap . loadAndValidateMetadata = sandbox . stub ( ) . resolves ( { 'hello' :'world' } ) ;
309
308
310
309
const metadata = await Bootstrap . getMetadata ( 'fake path' ) ;
@@ -314,7 +313,7 @@ describe('bootstrap.js', () => {
314
313
} ) ;
315
314
316
315
it ( 'should handle when files not available' , async ( ) => {
317
- pathExistsStub . returns ( false ) ;
316
+ pathExistsStub . rejects ( ) ;
318
317
319
318
const metadata = await Bootstrap . getMetadata ( 'fake path' ) ;
320
319
0 commit comments