@@ -103,7 +103,61 @@ describe('steps/provision.ts', () => {
103
103
) . rejects . toThrowError ( 'deployment not found' ) ;
104
104
} ) ;
105
105
106
- it ( 'works properly' , async ( ) => {
106
+ it ( 'returns partial deployment if runtime becomes cancelled' , async ( ) => {
107
+ await registry . publish ( [ 'hello:1.0.0' ] , '1234-main' , 'https://something.com' , '' ) ;
108
+
109
+ jest . mocked ( fakeRuntime . readDeploy ) . mockResolvedValue ( {
110
+ generator : 'cannon test' ,
111
+ timestamp : 1234 ,
112
+ state : {
113
+ 'contract.Woot' : {
114
+ version : BUILD_VERSION ,
115
+ hash : 'arst' ,
116
+ artifacts : {
117
+ contracts : {
118
+ Woot : {
119
+ address : '0xfoobar' ,
120
+ abi : [ ] ,
121
+ deployTxnHash : '0x' ,
122
+ contractName : 'Woot' ,
123
+ sourceName : 'Woot.sol' ,
124
+ deployedOn : 'contract.Woot' ,
125
+ } ,
126
+ } ,
127
+ } ,
128
+ } ,
129
+ } ,
130
+ options : { } ,
131
+ def : {
132
+ name : 'hello' ,
133
+ version : '1.0.0' ,
134
+ contract : {
135
+ Woot : { artifact : 'Woot' } ,
136
+ } ,
137
+ } as any ,
138
+ meta : { } ,
139
+ miscUrl : 'https://something.com' ,
140
+ } ) ;
141
+
142
+ jest . mocked ( fakeRuntime . putDeploy ) . mockResolvedValue ( 'ipfs://Qmsomething' ) ;
143
+ jest . mocked ( fakeRuntime . isCancelled ) . mockReturnValue ( true ) ;
144
+ console . log ( 'is c ancel' , fakeRuntime . isCancelled ( ) ) ;
145
+
146
+ const result = await action . exec (
147
+ fakeRuntime ,
148
+ fakeCtx ,
149
+ { source : 'hello:1.0.0' } ,
150
+ { name : 'package' , version : '1.0.0' , currentLabel : 'import.something' }
151
+ ) ;
152
+
153
+ expect ( result . imports ! [ 'something' ] . url ) . toEqual ( 'ipfs://Qmsomething' ) ;
154
+
155
+ expect ( jest . mocked ( fakeRuntime . putDeploy ) . mock . calls [ 0 ] [ 0 ] . status ) . toEqual ( 'partial' ) ;
156
+
157
+ jest . mocked ( fakeRuntime . isCancelled ) . mockReturnValue ( false ) ;
158
+ } ) ;
159
+
160
+ it ( 'works with complete deployment' , async ( ) => {
107
161
await registry . publish ( [ 'hello:1.0.0' ] , '1234-main' , 'https://something.com' , '' ) ;
108
162
109
163
jest . mocked ( fakeRuntime . readDeploy ) . mockResolvedValue ( {
0 commit comments