File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ import { testSignTransactionWithSolanaEncryptedKey } from './tests/wrapped-keys/
107107import { testBatchGeneratePrivateKeys } from './tests/wrapped-keys/testBatchGeneratePrivateKeys' ;
108108
109109import { setLitActionsCodeToLocal } from './tests/wrapped-keys/util' ;
110+ import { testUseEoaSessionSigsToRequestSingleResponse } from './tests/testUseEoaSessionSigsToRequestSingleResponse' ;
110111
111112// Use the current LIT action code to test against
112113setLitActionsCodeToLocal ( ) ;
@@ -170,6 +171,7 @@ setLitActionsCodeToLocal();
170171 testUseEoaSessionSigsToEncryptDecryptString,
171172 testUseEoaSessionSigsToEncryptDecryptFile,
172173 testUseEoaSessionSigsToEncryptDecryptZip,
174+ testUseEoaSessionSigsToRequestSingleResponse,
173175 } ;
174176
175177 const pkpSessionSigsTests = {
Original file line number Diff line number Diff line change 1+ import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs' ;
2+ import { TinnyEnvironment } from 'local-tests/setup/tinny-environment' ;
3+
4+ /**
5+ * Test Commands:
6+ * ✅ NETWORK=datil-dev yarn test:local --filter=testUseEoaSessionSigsToRequestSingleResponse
7+ * ✅ NETWORK=datil-test yarn test:local --filter=testUseEoaSessionSigsToRequestSingleResponse
8+ * ✅ NETWORK=datil yarn test:local --filter=testUseEoaSessionSigsToRequestSingleResponse
9+ */
10+ export const testUseEoaSessionSigsToRequestSingleResponse = async (
11+ devEnv : TinnyEnvironment
12+ ) => {
13+ const alice = await devEnv . createRandomPerson ( ) ;
14+
15+ const eoaSessionSigs = await getEoaSessionSigs ( devEnv , alice ) ;
16+
17+ const res = await devEnv . litNodeClient . executeJs ( {
18+ sessionSigs : eoaSessionSigs ,
19+ code : `(async () => {
20+ console.log('hello world')
21+ })();` ,
22+ numResponsesRequired : 1 ,
23+ } ) ;
24+
25+ devEnv . releasePrivateKeyFromUser ( alice ) ;
26+
27+ console . log ( 'res:' , res ) ;
28+
29+ // Expected output:
30+ // {
31+ // success: true,
32+ // signedData: {},
33+ // decryptedData: {},
34+ // claimData: {},
35+ // response: "",
36+ // logs: "hello world\n",
37+ // }
38+
39+ // -- assertions
40+ if ( res . response ) {
41+ throw new Error ( `Expected "response" to be falsy` ) ;
42+ }
43+
44+ if ( ! res . logs ) {
45+ throw new Error ( `Expected "logs" in res` ) ;
46+ }
47+
48+ if ( ! res . logs . includes ( 'hello world' ) ) {
49+ throw new Error ( `Expected "logs" to include 'hello world'` ) ;
50+ }
51+
52+ if ( ! res . success ) {
53+ throw new Error ( `Expected "success" in res` ) ;
54+ }
55+ } ;
You can’t perform that action at this time.
0 commit comments