@@ -53,7 +53,7 @@ describe('Wallet', () => {
5353    expect ( wallet . apiVersion ) . toBe ( '0.1.0' ) ; 
5454    expect ( typeof  wallet . name ) . toBe ( 'string' ) ; 
5555    expect ( wallet . name ) . toBe ( testWallet . properties . walletName ) ; 
56-     expect ( wallet . supportedExtensions ) . toEqual < WalletApiExtension [ ] > ( [ {  cip : 95  } ] ) ; 
56+     expect ( wallet . supportedExtensions ) . toEqual < WalletApiExtension [ ] > ( [ {  cip : 95  } ,   {   cip :  142   } ] ) ; 
5757    expect ( typeof  wallet . isEnabled ) . toBe ( 'function' ) ; 
5858    const  isEnabled  =  await  wallet . isEnabled ( ) ; 
5959    expect ( typeof  isEnabled ) . toBe ( 'boolean' ) ; 
@@ -98,6 +98,30 @@ describe('Wallet', () => {
9898      expect ( await  api . getExtensions ( ) ) . toEqual ( [ {  cip : 95  } ] ) ; 
9999    } ) ; 
100100
101+     test ( 'with cip142 extension' ,  async  ( )  =>  { 
102+       const  api  =  await  wallet . enable ( {  extensions : [ {  cip : 142  } ]  } ) ; 
103+       expect ( typeof  api ) . toBe ( 'object' ) ; 
104+       const  methods  =  new  Set ( Object . keys ( api ) ) ; 
105+       expect ( methods ) . toEqual ( new  Set ( [ ...CipMethodsMapping [ 30 ] ,  'cip142' ,  'experimental' ] ) ) ; 
106+       const  cip142Methods  =  new  Set ( Object . keys ( api . cip142 ! ) ) ; 
107+       expect ( cip142Methods ) . toEqual ( new  Set ( CipMethodsMapping [ 142 ] ) ) ; 
108+       expect ( await  wallet . isEnabled ( ) ) . toBe ( true ) ; 
109+       expect ( await  api . getExtensions ( ) ) . toEqual ( [ {  cip : 142  } ] ) ; 
110+     } ) ; 
111+ 
112+     test ( 'with cip95 and cip142 extensions' ,  async  ( )  =>  { 
113+       const  api  =  await  wallet . enable ( {  extensions : [ {  cip : 95  } ,  {  cip : 142  } ]  } ) ; 
114+       expect ( typeof  api ) . toBe ( 'object' ) ; 
115+       const  methods  =  new  Set ( Object . keys ( api ) ) ; 
116+       expect ( methods ) . toEqual ( new  Set ( [ ...CipMethodsMapping [ 30 ] ,  'cip95' ,  'cip142' ,  'experimental' ] ) ) ; 
117+       const  cip95Methods  =  new  Set ( Object . keys ( api . cip95 ! ) ) ; 
118+       expect ( cip95Methods ) . toEqual ( new  Set ( CipMethodsMapping [ 95 ] ) ) ; 
119+       const  cip142Methods  =  new  Set ( Object . keys ( api . cip142 ! ) ) ; 
120+       expect ( cip142Methods ) . toEqual ( new  Set ( CipMethodsMapping [ 142 ] ) ) ; 
121+       expect ( await  wallet . isEnabled ( ) ) . toBe ( true ) ; 
122+       expect ( await  api . getExtensions ( ) ) . toEqual ( [ {  cip : 95  } ,  {  cip : 142  } ] ) ; 
123+     } ) ; 
124+ 
101125    test ( 'no extensions wallet cannot enable cip95 extension' ,  async  ( )  =>  { 
102126      const  api  =  await  walletNoExtensions . enable ( {  extensions : [ {  cip : 95  } ]  } ) ; 
103127      expect ( await  walletNoExtensions . isEnabled ( ) ) . toBe ( true ) ; 
@@ -112,13 +136,15 @@ describe('Wallet', () => {
112136      expect ( await  wallet . isEnabled ( ) ) . toBe ( true ) ; 
113137      expect ( await  cip30api . getExtensions ( ) ) . toEqual ( [ ] ) ; 
114138
115-       const  cip95api  =  await  wallet . enable ( {  extensions : [ {  cip : 95  } ]  } ) ; 
116-       const  cip95methods  =  new  Set ( Object . keys ( cip95api ) ) ; 
117-       expect ( cip95methods ) . toEqual ( new  Set ( [ ...CipMethodsMapping [ 30 ] ,  'cip95' ,  'experimental' ] ) ) ; 
118-       const  cip95InnerMethods  =  new  Set ( Object . keys ( cip95api . cip95 ! ) ) ; 
139+       const  apiWithExtension  =  await  wallet . enable ( {  extensions : [ {  cip : 95   } ,   {   cip :  142  } ]  } ) ; 
140+       const  cip95methods  =  new  Set ( Object . keys ( apiWithExtension ) ) ; 
141+       expect ( cip95methods ) . toEqual ( new  Set ( [ ...CipMethodsMapping [ 30 ] ,  'cip95' ,  'cip142'  ,   ' experimental'] ) ) ; 
142+       const  cip95InnerMethods  =  new  Set ( Object . keys ( apiWithExtension . cip95 ! ) ) ; 
119143      expect ( cip95InnerMethods ) . toEqual ( new  Set ( CipMethodsMapping [ 95 ] ) ) ; 
144+       const  cip142Methods  =  new  Set ( Object . keys ( apiWithExtension . cip142 ! ) ) ; 
145+       expect ( cip142Methods ) . toEqual ( new  Set ( CipMethodsMapping [ 142 ] ) ) ; 
120146      expect ( await  wallet . isEnabled ( ) ) . toBe ( true ) ; 
121-       expect ( await  cip95api . getExtensions ( ) ) . toEqual ( [ {  cip : 95  } ] ) ; 
147+       expect ( await  apiWithExtension . getExtensions ( ) ) . toEqual ( [ {  cip : 95   } ,   {   cip :  142  } ] ) ; 
122148    } ) ; 
123149
124150    test ( 'unsupported extensions does not reject and returns cip30 methods' ,  async  ( )  =>  { 
0 commit comments