11import { CommunicationProtocolEnum , DaprClient , DaprServer , HttpMethod } from '../../src' ;
2+ import { testIt } from './utils' ;
23
34const serverHost = '127.0.0.1' ;
45const serverPort = '50001' ;
@@ -33,15 +34,15 @@ describe('grpc/main', () => {
3334 } ) ;
3435
3536 describe ( 'metadata' , ( ) => {
36- it ( 'should be able to get the metadata of the Dapr sidecar' , async ( ) => {
37+ testIt ( 'should be able to get the metadata of the Dapr sidecar' , async ( ) => {
3738 await client . metadata . get ( ) ;
3839
3940 // app id is not set in grpc?
4041 // expect(res.id.length).toBeGreaterThan(0);
4142 // expect(res.components.length).toBeGreaterThan(0);
4243 } ) ;
4344
44- it ( 'should be able to set a custom metadata value of the Dapr sidecar' , async ( ) => {
45+ testIt ( 'should be able to set a custom metadata value of the Dapr sidecar' , async ( ) => {
4546 await client . metadata . set ( "testKey" , "Hello World" ) ;
4647
4748 const res = await client . metadata . get ( ) ;
@@ -55,14 +56,14 @@ describe('grpc/main', () => {
5556 } ) ;
5657
5758 describe ( 'health' , ( ) => {
58- it ( 'should return true if Dapr is ready' , async ( ) => {
59+ testIt ( 'should return true if Dapr is ready' , async ( ) => {
5960 const res = await client . health . isHealthy ( ) ;
6061 expect ( res ) . toEqual ( true ) ;
6162 } ) ;
6263 } ) ;
6364
6465 describe ( 'binding' , ( ) => {
65- it ( 'should be able to receive events' , async ( ) => {
66+ testIt ( 'should be able to receive events' , async ( ) => {
6667 await client . binding . send ( 'binding-mqtt' , 'create' , { hello : 'world' } ) ;
6768
6869 // Delay a bit for event to arrive
@@ -76,7 +77,7 @@ describe('grpc/main', () => {
7677 } ) ;
7778
7879 describe ( 'pubsub' , ( ) => {
79- it ( 'should be able to send and receive events' , async ( ) => {
80+ testIt ( 'should be able to send and receive events' , async ( ) => {
8081 await client . pubsub . publish ( 'pubsub-redis' , 'test-topic' , { hello : 'world' } ) ;
8182
8283 // Delay a bit for event to arrive
@@ -89,14 +90,14 @@ describe('grpc/main', () => {
8990 expect ( mockPubSubSubscribe . mock . calls [ 0 ] [ 0 ] [ 'hello' ] ) . toEqual ( 'world' ) ;
9091 } ) ;
9192
92- it ( 'should receive if it was successful or not' , async ( ) => {
93+ testIt ( 'should receive if it was successful or not' , async ( ) => {
9394 const res = await client . pubsub . publish ( 'pubsub-redis' , 'test-topic' , { hello : 'world' } ) ;
9495 expect ( res ) . toEqual ( true ) ;
9596 } ) ;
9697 } ) ;
9798
9899 describe ( 'invoker' , ( ) => {
99- it ( 'should be able to listen and invoke a service with GET' , async ( ) => {
100+ testIt ( 'should be able to listen and invoke a service with GET' , async ( ) => {
100101 const mock = jest . fn ( async ( _data : object ) => ( { hello : 'world' } ) ) ;
101102
102103 await server . invoker . listen ( 'hello-world' , mock , { method : HttpMethod . GET } ) ;
@@ -109,7 +110,7 @@ describe('grpc/main', () => {
109110 expect ( JSON . stringify ( res ) ) . toEqual ( `{"hello":"world"}` ) ;
110111 } ) ;
111112
112- it ( 'should be able to listen and invoke a service with POST data' , async ( ) => {
113+ testIt ( 'should be able to listen and invoke a service with POST data' , async ( ) => {
113114 const mock = jest . fn ( async ( _data : object ) => ( { hello : 'world' } ) ) ;
114115
115116 await server . invoker . listen ( 'hello-world' , mock , { method : HttpMethod . POST } ) ;
@@ -126,19 +127,19 @@ describe('grpc/main', () => {
126127 } ) ;
127128
128129 describe ( 'secrets' , ( ) => {
129- it ( 'should be able to correctly fetch the secrets by a single key' , async ( ) => {
130+ testIt ( 'should be able to correctly fetch the secrets by a single key' , async ( ) => {
130131 const res = await client . secret . get ( 'secret-envvars' , 'TEST_SECRET_1' ) ;
131132 expect ( JSON . stringify ( res ) ) . toEqual ( `{"TEST_SECRET_1":"secret_val_1"}` ) ;
132133 } ) ;
133134
134- it ( 'should be able to correctly fetch the secrets in bulk' , async ( ) => {
135+ testIt ( 'should be able to correctly fetch the secrets in bulk' , async ( ) => {
135136 const res = await client . secret . getBulk ( 'secret-envvars' ) ;
136137 expect ( Object . keys ( res ) . length ) . toBeGreaterThan ( 1 ) ;
137138 } ) ;
138139 } ) ;
139140
140141 describe ( 'state' , ( ) => {
141- it ( 'should be able to save the state' , async ( ) => {
142+ testIt ( 'should be able to save the state' , async ( ) => {
142143 await client . state . save ( 'state-redis' , [
143144 {
144145 key : 'key-1' ,
@@ -158,7 +159,7 @@ describe('grpc/main', () => {
158159 expect ( res ) . toEqual ( 'value-1' ) ;
159160 } ) ;
160161
161- it ( 'should be able to get the state in bulk' , async ( ) => {
162+ testIt ( 'should be able to get the state in bulk' , async ( ) => {
162163 await client . state . save ( 'state-redis' , [
163164 {
164165 key : 'key-1' ,
@@ -184,7 +185,7 @@ describe('grpc/main', () => {
184185 ) ;
185186 } ) ;
186187
187- it ( 'should be able to delete a key from the state store' , async ( ) => {
188+ testIt ( 'should be able to delete a key from the state store' , async ( ) => {
188189 await client . state . save ( 'state-redis' , [
189190 {
190191 key : 'key-1' ,
@@ -205,7 +206,7 @@ describe('grpc/main', () => {
205206 expect ( res ) . toEqual ( '' ) ;
206207 } ) ;
207208
208- it ( 'should be able to perform a transaction that replaces a key and deletes another' , async ( ) => {
209+ testIt ( 'should be able to perform a transaction that replaces a key and deletes another' , async ( ) => {
209210 await client . state . transaction ( 'state-redis' , [
210211 {
211212 operation : 'upsert' ,
@@ -228,7 +229,7 @@ describe('grpc/main', () => {
228229 expect ( resTransactionUpsert ) . toEqual ( 'my-new-data-1' ) ;
229230 } ) ;
230231
231- it ( 'should be able to perform a transaction with metadata' , async ( ) => {
232+ testIt ( 'should be able to perform a transaction with metadata' , async ( ) => {
232233 await client . state . transaction ( 'state-redis' , [
233234 {
234235 operation : 'upsert' ,
@@ -256,7 +257,7 @@ describe('grpc/main', () => {
256257
257258 // Note: actors require an external dependency and are disabled by default for now until we can have actors in Javascript
258259 // describe('actors', () => {
259- // it ('should be able to invoke a method on an actor', async () => {
260+ // testIt ('should be able to invoke a method on an actor', async () => {
260261 // const clientActor = new DaprClient(daprHost, daprPortActor);
261262
262263 // await clientActor.actor.invoke("POST", "DemoActor", "MyActorId1", "SetDataAsync", { PropertyA: "hello", PropertyB: "world", ToNotExistKey: "this should not exist since we only have PropertyA and PropertyB" });
@@ -265,7 +266,7 @@ describe('grpc/main', () => {
265266 // expect(JSON.stringify(res)).toEqual(`{\"propertyA\":\"hello\",\"propertyB\":\"world\"}`);
266267 // });
267268
268- // it ('should be able to manipulate the state through a transaction of an actor', async () => {
269+ // testIt ('should be able to manipulate the state through a transaction of an actor', async () => {
269270 // const clientActor = new DaprClient(daprHost, daprPortActor);
270271 // await clientActor.actor.stateTransaction("DemoActor", "MyActorId1", [
271272 // {
@@ -297,7 +298,7 @@ describe('grpc/main', () => {
297298 // expect(JSON.stringify(resActorStateGet2)).toEqual(`\"my-new-data-1\"`);
298299 // });
299300
300- // it ('should be able to get all the actors', async () => {
301+ // testIt ('should be able to get all the actors', async () => {
301302 // const clientActor = new DaprClient(daprHost, daprPortActor);
302303
303304 // const res = await clientActor.actor.getActors();
0 commit comments