@@ -13,21 +13,23 @@ const signAuthMessage = async (privateKey: string) => {
1313describe ( 'encryption' , ( ) => {
1414 describe ( 'getAuthMessage' , ( ) => {
1515 it ( 'should get auth message when valid public key is provided' , async ( ) => {
16+ console . log ( 'testing getAuthMessage' )
1617 const response = await lighthouse . getAuthMessage (
1718 '0x1Ec09D4B3Cb565b7CCe2eEAf71CC90c9b46c5c26'
1819 )
1920 expect ( response . data . message ) . toMatch (
2021 / ^ P l e a s e s i g n t h i s m e s s a g e t o p r o v e /
2122 )
22- } , 60000 )
23+ } , 6000 )
2324
2425 it ( 'should not get auth message when invalid public key is provided' , async ( ) => {
2526 try {
27+ console . log ( 'testing getAuthMessage with invalid public key' )
2628 const response = await lighthouse . getAuthMessage ( 'invalidPublicKey' )
2729 } catch ( error ) {
2830 expect ( error . message ) . toBe ( 'Invalid public Key' )
2931 }
30- } , 60000 )
32+ } , 6000 )
3133 } )
3234 describe ( 'fetchEncryptionKey' , ( ) => {
3335 const publicKey = '0xa3c960b3ba29367ecbcaf1430452c6cd7516f588'
@@ -36,17 +38,19 @@ describe('encryption', () => {
3638 const cid = 'QmVkHgHnYVUfvTXsaJisHRgc89zsrgVL6ATh9mSiegRYrX'
3739
3840 it ( 'should fetch encryption key when correct public-private key pair is provided' , async ( ) => {
41+ console . log ( 'testing fetchEncryptionKey' )
3942 const signed_message = await signAuthMessage ( privateKey )
4043 const response = await lighthouse . fetchEncryptionKey (
4144 cid ,
4245 publicKey ,
4346 signed_message
4447 )
4548 expect ( typeof response . data . key ) . toBe ( 'string' )
46- } , 80000 )
49+ } , 8000 )
4750
4851 it ( 'should not fetch encryption key when incorrect public-private key pair is provided' , async ( ) => {
4952 try {
53+ console . log ( 'testing fetchEncryptionKey with incorrect key pair' )
5054 const randomPublicKey = '0x1ccEF158Dcbe6643F1cC577F236af79993F4D066'
5155 const signed_message = await signAuthMessage ( privateKey )
5256 const response = await lighthouse . fetchEncryptionKey (
@@ -57,7 +61,7 @@ describe('encryption', () => {
5761 } catch ( error ) {
5862 expect ( typeof error . message ) . toBe ( 'string' )
5963 }
60- } , 60000 )
64+ } , 6000 )
6165
6266 it ( 'should not fetch encryption key when incorrect CID is provided' , async ( ) => {
6367 try {
@@ -72,7 +76,7 @@ describe('encryption', () => {
7276 } catch ( error ) {
7377 expect ( error ) . toBe ( 'cid not found' )
7478 }
75- } , 60000 )
79+ } , 6000 )
7680
7781 it ( 'should not fetch encryption key when incorrect signature is provided' , async ( ) => {
7882 try {
@@ -86,7 +90,7 @@ describe('encryption', () => {
8690 } catch ( error ) {
8791 expect ( error . message ) . toBe ( 'Invalid Signature' )
8892 }
89- } , 60000 )
93+ } , 6000 )
9094 } )
9195 describe ( 'shareFile' , ( ) => {
9296 const publicKey = '0x969e19A952A9aeF004e4F711eE481D72A59470B1'
@@ -105,7 +109,7 @@ describe('encryption', () => {
105109 expect ( response . data . cid ) . toEqual ( cid )
106110 expect ( response . data . shareTo ) . toEqual ( shareTo )
107111 expect ( response . data . status ) . toBe ( 'Success' )
108- } , 60000 )
112+ } , 10000 )
109113
110114 it ( 'should deny access for sharing file uploaded by other account' , async ( ) => {
111115 try {
@@ -118,9 +122,9 @@ describe('encryption', () => {
118122 signed_message
119123 )
120124 } catch ( error ) {
121- expect ( error . message ) . toEqual ( 'Access Denied ' )
125+ expect ( error . message . message . message ) . toEqual ( 'access denied ' )
122126 }
123- } , 60000 )
127+ } , 10000 )
124128 } )
125129 describe ( 'applyAccessCondition' , ( ) => {
126130 const publicKey = '0x969e19A952A9aeF004e4F711eE481D72A59470B1'
@@ -162,7 +166,7 @@ describe('encryption', () => {
162166 )
163167 expect ( response . data . status ) . toEqual ( 'Success' )
164168 expect ( response . data . cid ) . toEqual ( cid )
165- } , 60000 )
169+ } , 10000 )
166170 } )
167171 describe ( 'revokeFileAccess' , ( ) => {
168172 it ( 'should revoke file access to provided public address' , async ( ) => {
@@ -182,7 +186,7 @@ describe('encryption', () => {
182186 expect ( response . data . cid ) . toEqual ( cid )
183187 expect ( response . data . status ) . toEqual ( 'Success' )
184188 expect ( response . data . revokeTo ) . toEqual ( revokeTo )
185- } , 20000 )
189+ } , 10000 )
186190 } )
187191 describe ( 'getAccessConditions' , ( ) => {
188192 it ( 'should retrieve access conditions from provided cid' , async ( ) => {
@@ -194,6 +198,6 @@ describe('encryption', () => {
194198 expect ( response . data ) . toHaveProperty ( 'conditions' )
195199 expect ( response . data ) . toHaveProperty ( 'sharedTo' )
196200 expect ( response . data . cid ) . toEqual ( cid )
197- } , 20000 )
201+ } , 10000 )
198202 } )
199203} )
0 commit comments