@@ -20,7 +20,7 @@ let fundingSource: KeyringPair;
2020describe ( '#schemas pallet tests' , function ( ) {
2121 let keys : KeyringPair ;
2222 let accountWithNoFunds : KeyringPair ;
23- const createdIntents : { intentId : number ; intentName : string ; schemaIds : number [ ] } [ ] = [ ] ;
23+ const createdIntents : { intentId : number ; intentName : string ; payloadLocation : string ; schemaIds : number [ ] } [ ] = [ ] ;
2424 const createdIntentGroups : { intentGroupId : number ; intentIds : number [ ] ; intentGroupName : string } [ ] = [ ] ;
2525
2626 before ( async function ( ) {
@@ -29,10 +29,16 @@ describe('#schemas pallet tests', function () {
2929 accountWithNoFunds = createKeys ( ) ;
3030
3131 const intentName = 'e-e.' + generateSchemaPartialName ( 20 ) ;
32- const f = ExtrinsicHelper . createIntent ( keys , 'OnChain' , [ ] , intentName ) ;
32+ const payloadLocation = 'OnChain' ;
33+ const f = ExtrinsicHelper . createIntent ( keys , payloadLocation , [ ] , intentName ) ;
3334 const { target : createIntentEvent } = await f . fundAndSend ( fundingSource ) ;
3435 if ( createIntentEvent && ExtrinsicHelper . apiPromise . events . schemas . IntentCreated . is ( createIntentEvent ) ) {
35- createdIntents . push ( { intentId : createIntentEvent . data . intentId . toNumber ( ) , intentName, schemaIds : [ ] } ) ;
36+ createdIntents . push ( {
37+ intentId : createIntentEvent . data . intentId . toNumber ( ) ,
38+ intentName,
39+ payloadLocation,
40+ schemaIds : [ ] ,
41+ } ) ;
3642 }
3743
3844 assert . equal ( createdIntents . length , 1 ) ;
@@ -61,20 +67,23 @@ describe('#schemas pallet tests', function () {
6167 } ) ;
6268 } ) ;
6369
64- it ( 'should successfully create an intent with a name' , async function ( ) {
65- const intentName = 'e-e.' + generateSchemaPartialName ( 20 ) ;
66- const f = ExtrinsicHelper . createIntent ( keys , 'OnChain' , [ ] , intentName ) ;
67- const { target : createIntentEvent , eventMap } = await f . fundAndSend ( fundingSource ) ;
68- if ( createIntentEvent && ExtrinsicHelper . apiPromise . events . schemas . IntentCreated . is ( createIntentEvent ) ) {
69- createdIntents . push ( {
70- intentId : createIntentEvent . data . intentId . toNumber ( ) ,
71- intentName : createIntentEvent . data . intentName . toString ( ) ,
72- schemaIds : [ ] ,
73- } ) ;
74- }
70+ [ 'OnChain' , 'OffChain' , 'Itemized' , 'Paginated' , 'IPFS' ] . forEach ( ( payloadLocation ) => {
71+ it ( `should successfully create an intent with a name and payload location ${ payloadLocation } ` , async function ( ) {
72+ const intentName = 'e-e.' + generateSchemaPartialName ( 20 ) ;
73+ const f = ExtrinsicHelper . createIntent ( keys , 'OnChain' , [ ] , intentName ) ;
74+ const { target : createIntentEvent , eventMap } = await f . fundAndSend ( fundingSource ) ;
75+ if ( createIntentEvent && ExtrinsicHelper . apiPromise . events . schemas . IntentCreated . is ( createIntentEvent ) ) {
76+ createdIntents . push ( {
77+ intentId : createIntentEvent . data . intentId . toNumber ( ) ,
78+ intentName : createIntentEvent . data . intentName . toString ( ) ,
79+ payloadLocation,
80+ schemaIds : [ ] ,
81+ } ) ;
82+ }
7583
76- assertExtrinsicSuccess ( eventMap ) ;
77- assert . notEqual ( createIntentEvent , undefined ) ;
84+ assertExtrinsicSuccess ( eventMap ) ;
85+ assert . notEqual ( createIntentEvent , undefined ) ;
86+ } ) ;
7887 } ) ;
7988
8089 it ( 'create intent should fail if name is a duplicate' , async function ( ) {
@@ -85,6 +94,7 @@ describe('#schemas pallet tests', function () {
8594 createdIntents . push ( {
8695 intentId : createIntentEvent . data . intentId . toNumber ( ) ,
8796 intentName : createIntentEvent . data . intentName . toString ( ) ,
97+ payloadLocation : 'OnChain' ,
8898 schemaIds : [ ] ,
8999 } ) ;
90100 }
0 commit comments