File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed
Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -250,13 +250,16 @@ export class ContractAPI {
250250 interfaceVersion : string ;
251251
252252 @IsString ( )
253- address : string ;
253+ @IsOptional ( )
254+ address ?: string ;
254255
255256 @IsString ( )
256- channel : string ;
257+ @IsOptional ( )
258+ channel ?: string ;
257259
258260 @IsString ( )
259- chaincode : string ;
261+ @IsOptional ( )
262+ chaincode ?: string ;
260263}
261264
262265export class ContractAPIURLs {
Original file line number Diff line number Diff line change @@ -101,6 +101,34 @@ describe('Smart Contracts', () => {
101101 } ) ;
102102 } ) ;
103103
104+ test ( 'Create contract API with Fabric' , async ( ) => {
105+ const req : ContractAPI = {
106+ name : 'my-api-fabric' ,
107+ channel : '0x123' ,
108+ chaincode : 'chaincode' ,
109+ interfaceName : 'my-contract' ,
110+ interfaceVersion : '1.0' ,
111+ } ;
112+ const api = {
113+ name : 'my-api-fabric' ,
114+ message : 'msg1' ,
115+ } as FireFlyContractAPIResponse ;
116+
117+ mockFireFly . createContractAPI . mockResolvedValueOnce ( api ) ;
118+
119+ await request ( server )
120+ . post ( '/api/contracts/apifabric' )
121+ . send ( req )
122+ . expect ( 202 )
123+ . expect ( { type : 'message' , id : 'msg1' } ) ;
124+
125+ expect ( mockFireFly . createContractAPI ) . toHaveBeenCalledWith ( {
126+ interface : { name : 'my-contract' , version : '1.0' } ,
127+ location : { chaincode : 'chaincode' , channel : '0x123' } ,
128+ name : 'my-api-fabric' ,
129+ } ) ;
130+ } ) ;
131+
104132 test ( 'Get contract Interfaces' , async ( ) => {
105133 const int = [
106134 {
You can’t perform that action at this time.
0 commit comments