@@ -6,28 +6,19 @@ import {
6
6
runIntegrationTest ,
7
7
} from "./testLibrary.mjs" ;
8
8
9
- // Validation function to check required environment variables
10
- async function validateEnvironment ( requiredVars ) {
11
- const missing = requiredVars . filter ( varName => ! process . env [ varName ] ) ;
12
- if ( missing . length > 0 ) {
13
- throw new Error ( `Required environment variables not set: ${ missing . join ( ', ' ) } \nPlease set these variables before running the tests.` ) ;
14
- }
15
- return true ;
16
- }
17
9
18
10
async function helloTrump ( ) {
19
11
const reply = await send ( "Hi" ) ;
20
-
21
12
assert ( reply . length > 0 , "Response should not be empty" ) ;
22
13
const response = reply [ 0 ] ;
23
14
assert ( response . text , "Response should have text property" ) ;
24
15
assert ( response . text . length > 10 , `Response should be longer than 10 characters, is ${ reply . length } ` ) ;
25
-
26
16
}
17
+ helloTrump . description = "Hello Trump" ;
18
+ helloTrump . skipIf = ! process . env . OPENAI_API_KEY ;
27
19
28
- async function coinbaseCommerceChargeTest ( ) {
29
- await validateEnvironment ( [ 'COINBASE_COMMERCE_KEY' ] ) ;
30
20
21
+ async function coinbaseCommerceChargeTest ( ) {
31
22
const chargeDescription = "Exclusive digital artwork collection" ;
32
23
const chargeRequest = `Create a charge for $100 USD for Digital Art NFT with description '${ chargeDescription } '` ;
33
24
const response = await send ( chargeRequest ) ;
@@ -106,8 +97,15 @@ async function coinbaseCommerceChargeTest() {
106
97
assert . equal ( chargeData . data . hosted_url , createdChargeUrl , "Hosted URLs should match" ) ;
107
98
assert . equal ( chargeData . data . description , chargeDescription , "Charge description should match" )
108
99
}
100
+ coinbaseCommerceChargeTest . description = "Coinbase Charge" ;
101
+ coinbaseCommerceChargeTest . skipIf = ! process . env . OPENAI_API_KEY || ! process . env . COINBASE_COMMERCE_KEY ;
102
+
103
+
109
104
110
- const testSuite = [ helloTrump , coinbaseCommerceChargeTest ] ; // Add tests here
105
+ const testSuite = [
106
+ helloTrump ,
107
+ coinbaseCommerceChargeTest ,
108
+ ] ;
111
109
try {
112
110
for ( const test of testSuite ) await runIntegrationTest ( test ) ;
113
111
} catch ( error ) {
0 commit comments