Skip to content

Commit 3ff006f

Browse files
Add test for metadata
Signed-off-by: Xavier Geerinck <[email protected]>
1 parent 7fc9768 commit 3ff006f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/implementation/Client/GRPCClient/configuration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { GetConfigurationResponse as GetConfigurationResponseResult } from '../.
2020
import { SubscribeConfigurationResponse as SubscribeConfigurationResponseResult } from '../../../types/configuration/SubscribeConfigurationResponse';
2121
import { SubscribeConfigurationCallback } from '../../../types/configuration/SubscribeConfigurationCallback';
2222

23-
// https://docs.dapr.io/reference/api/configuration_api
2423
export default class GRPCClientConfiguration implements IClientConfiguration {
2524
client: GRPCClient;
2625

test/e2e/main.grpc.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,7 @@ describe('grpc/main', () => {
291291
expect(config.items.filter(i => i.key == "myconfigkey3")[0].value).toEqual("key3_initialvalue");
292292
});
293293

294-
// OK (temp)
295294
it('should be able to get the configuration items with metadata', async () => {
296-
// await server.configuration.subscribe();
297295
await client.configuration.get("config-redis", ["myconfigkey1"], { "hello": "world" });
298296

299297
// Disabled for now as I am unsure if Dapr returns the metadata items
@@ -327,6 +325,17 @@ describe('grpc/main', () => {
327325
expect(m.mock.calls[0][0].items[0].value).toEqual("key1_mynewvalue");
328326
});
329327

328+
it('should be able to subscribe with metadata', async () => {
329+
const m = jest.fn(async (_res: SubscribeConfigurationResponse) => { return; });
330+
331+
await client.configuration.subscribeWithMetadata("config-redis", ["myconfigkey1", "myconfigkey2"], { "hello": "world" }, m);
332+
await DockerUtils.executeDockerCommand("dapr_redis redis-cli MSET myconfigkey1 key1_mynewvalue||1");
333+
334+
expect(m.mock.calls.length).toEqual(1);
335+
expect(m.mock.calls[0][0].items[0].key).toEqual("myconfigkey1");
336+
expect(m.mock.calls[0][0].items[0].value).toEqual("key1_mynewvalue");
337+
});
338+
330339
it('should be able to subscribe to configuration items through multiple streams', async () => {
331340
const m1 = jest.fn(async (_res: SubscribeConfigurationResponse) => { return; });
332341
const m2 = jest.fn(async (_res: SubscribeConfigurationResponse) => { return; });

0 commit comments

Comments
 (0)