File tree 3 files changed +23
-6
lines changed
3 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,16 @@ const client = new Client();
19
19
assert ( client ) ;
20
20
21
21
async function main ( ) {
22
- const hello = await client . hello . sayHello ( {
23
- serviceName : 'helloworld' ,
24
- name : 'js-sdk' ,
25
- } ) ;
26
- console . log ( '%s' , hello ) ;
22
+ try {
23
+ const hello = await client . hello . sayHello ( {
24
+ serviceName : 'helloworld' ,
25
+ name : 'js-sdk' ,
26
+ } ) ;
27
+ console . log ( '%s' , hello ) ;
28
+ } catch ( err ) {
29
+ console . error ( 'sayHello error: %s' , err ) ;
30
+ }
31
+ client . close ( ) ;
27
32
}
28
33
29
34
main ( ) ;
Original file line number Diff line number Diff line change @@ -193,4 +193,8 @@ export class Client {
193
193
}
194
194
return this . _cryption ;
195
195
}
196
+
197
+ close ( ) {
198
+ this . _runtime . close ( ) ;
199
+ }
196
200
}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import { Client } from '../../../src';
17
17
import { CreateMetadataHook } from '../../../src/client/API' ;
18
18
import { CustomClient } from './fixtures/CustomClient' ;
19
19
20
- describe ( 'client/Client.test.ts' , ( ) => {
20
+ describe ( 'test/unit/ client/Client.test.ts' , ( ) => {
21
21
let client : Client ;
22
22
beforeAll ( async ( ) => {
23
23
client = new Client ( ) ;
@@ -32,6 +32,10 @@ describe('client/Client.test.ts', () => {
32
32
assert ( client . state ) ;
33
33
} ) ;
34
34
35
+ afterAll ( ( ) => {
36
+ client . close ( ) ;
37
+ } ) ;
38
+
35
39
describe ( 'custom Client' , ( ) => {
36
40
let customClient : CustomClient ;
37
41
beforeAll ( ( ) => {
@@ -54,5 +58,9 @@ describe('client/Client.test.ts', () => {
54
58
const hello2 = await customClient . hello . sayHello ( { name : 'js-sdk' } ) ;
55
59
assert . equal ( hello2 , 'greeting, js-sdk' ) ;
56
60
} ) ;
61
+
62
+ afterAll ( ( ) => {
63
+ customClient . close ( ) ;
64
+ } ) ;
57
65
} ) ;
58
66
} ) ;
You can’t perform that action at this time.
0 commit comments