@@ -65,27 +65,33 @@ describe("AcpJobOffering Unit Testing", () => {
6565 "MockJob" ,
6666 100 ,
6767 PriceType . FIXED ,
68+ true ,
6869 ) ;
6970
7071 expect ( offering ) . toBeInstanceOf ( AcpJobOffering ) ;
7172 expect ( offering . providerAddress ) . toBe ( "0xProvider" ) ;
7273 expect ( offering . name ) . toBe ( "MockJob" ) ;
7374 expect ( offering . price ) . toBe ( 100 ) ;
7475 expect ( offering . priceType ) . toBe ( PriceType . FIXED ) ;
76+ expect ( offering . requiredFunds ) . toBe ( true ) ;
7577 expect ( offering . requirement ) . toBe ( undefined ) ;
78+ expect ( offering . deliverable ) . toBe ( undefined ) ;
7679 } ) ;
7780
78- it ( "should use default priceType of FIXED" , ( ) => {
81+ it ( "should use priceType FIXED and requiredFunds " , ( ) => {
7982 const offering = new AcpJobOffering (
8083 mockAcpClient ,
8184 mockContractClient ,
8285 "0xProvider" as Address ,
8386 "MockJob" ,
8487 100 ,
88+ PriceType . FIXED ,
89+ false ,
8590 ) ;
8691
8792 expect ( offering ) . toBeInstanceOf ( AcpJobOffering ) ;
8893 expect ( offering . priceType ) . toBe ( PriceType . FIXED ) ;
94+ expect ( offering . requiredFunds ) . toBe ( false ) ;
8995 } ) ;
9096
9197 it ( "should accept custom priceType" , ( ) => {
@@ -96,6 +102,7 @@ describe("AcpJobOffering Unit Testing", () => {
96102 "MockJob" ,
97103 100 ,
98104 PriceType . PERCENTAGE ,
105+ true ,
99106 ) ;
100107
101108 expect ( offering . priceType ) . toBe ( PriceType . PERCENTAGE ) ;
@@ -108,7 +115,8 @@ describe("AcpJobOffering Unit Testing", () => {
108115 "0xProvider" as Address ,
109116 "MockJob" ,
110117 100 ,
111- undefined ,
118+ PriceType . FIXED ,
119+ true ,
112120 "custom requirement" ,
113121 ) ;
114122
@@ -128,13 +136,50 @@ describe("AcpJobOffering Unit Testing", () => {
128136 "0xProvider" as Address ,
129137 "MockJob" ,
130138 100 ,
131- undefined ,
139+ PriceType . FIXED ,
140+ true ,
132141 requirementObject ,
133142 ) ;
134143
135144 expect ( offering ) . toBeInstanceOf ( AcpJobOffering ) ;
136145 expect ( offering . requirement ) . toBe ( requirementObject ) ;
137146 } ) ;
147+
148+ it ( "should accept deliverable as string" , ( ) => {
149+ const offering = new AcpJobOffering (
150+ mockAcpClient ,
151+ mockContractClient ,
152+ "0xProvider" as Address ,
153+ "MockJob" ,
154+ 100 ,
155+ PriceType . FIXED ,
156+ true ,
157+ undefined ,
158+ "custom deliverable" ,
159+ ) ;
160+
161+ expect ( offering ) . toBeInstanceOf ( AcpJobOffering ) ;
162+ expect ( offering . deliverable ) . toBe ( "custom deliverable" ) ;
163+ } ) ;
164+
165+ it ( "should accept deliverable as object" , ( ) => {
166+ const deliverableObject = { type : "image" , format : "png" } ;
167+
168+ const offering = new AcpJobOffering (
169+ mockAcpClient ,
170+ mockContractClient ,
171+ "0xProvider" as Address ,
172+ "MockJob" ,
173+ 100 ,
174+ PriceType . FIXED ,
175+ false ,
176+ undefined ,
177+ deliverableObject ,
178+ ) ;
179+
180+ expect ( offering ) . toBeInstanceOf ( AcpJobOffering ) ;
181+ expect ( offering . deliverable ) . toEqual ( deliverableObject ) ;
182+ } ) ;
138183 } ) ;
139184
140185 describe ( "initiateJob" , ( ) => {
@@ -161,7 +206,8 @@ describe("AcpJobOffering Unit Testing", () => {
161206 "0xProvider" as Address ,
162207 "Generate Image" ,
163208 100 ,
164- undefined ,
209+ PriceType . FIXED ,
210+ true ,
165211 ) ;
166212
167213 const result = await offering . initiateJob (
@@ -218,6 +264,7 @@ describe("AcpJobOffering Unit Testing", () => {
218264 "Generate Image" ,
219265 100 ,
220266 PriceType . FIXED ,
267+ true ,
221268 requirementSchema ,
222269 ) ;
223270
@@ -249,6 +296,7 @@ describe("AcpJobOffering Unit Testing", () => {
249296 "Generate Image" ,
250297 100 ,
251298 PriceType . FIXED ,
299+ true ,
252300 requirementSchema ,
253301 ) ;
254302
@@ -286,6 +334,7 @@ describe("AcpJobOffering Unit Testing", () => {
286334 "Generate Image" ,
287335 100 ,
288336 PriceType . PERCENTAGE ,
337+ true ,
289338 ) ;
290339
291340 const result = await offering . initiateJob (
@@ -324,6 +373,8 @@ describe("AcpJobOffering Unit Testing", () => {
324373 "0xProvider" as Address ,
325374 "Generate Image" ,
326375 100 ,
376+ PriceType . FIXED ,
377+ true ,
327378 ) ;
328379
329380 const result = await offering . initiateJob (
@@ -374,6 +425,8 @@ describe("AcpJobOffering Unit Testing", () => {
374425 "0xProvider" as Address ,
375426 "Generate Image" ,
376427 100 ,
428+ PriceType . FIXED ,
429+ true ,
377430 ) ;
378431
379432 const result = await offering . initiateJob (
0 commit comments