Skip to content

Commit 2ea355f

Browse files
committed
fix tests
1 parent 3675e16 commit 2ea355f

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

packages/client/lib/cluster/request-response-policies/dynamic-policy-resolver.spec.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ describe('DynamicPolicyResolverFactory', () => {
2121
std: {
2222
ping: {
2323
request: REQUEST_POLICIES_WITH_DEFAULTS.DEFAULT_KEYLESS,
24-
response: RESPONSE_POLICIES_WITH_DEFAULTS.DEFAULT_KEYLESS
24+
response: RESPONSE_POLICIES_WITH_DEFAULTS.DEFAULT_KEYLESS,
25+
isKeyless: true
2526
}
2627
}
2728
});
@@ -50,7 +51,8 @@ describe('DynamicPolicyResolverFactory', () => {
5051
step: 0,
5152
categories: new Set(),
5253
policies: { request: undefined, response: undefined },
53-
isKeyless: true
54+
isKeyless: true,
55+
subcommands: []
5456
}
5557
];
5658

@@ -76,7 +78,8 @@ describe('DynamicPolicyResolverFactory', () => {
7678
step: 1,
7779
categories: new Set(),
7880
policies: { request: undefined, response: undefined },
79-
isKeyless: false
81+
isKeyless: false,
82+
subcommands: []
8083
}
8184
];
8285

@@ -102,7 +105,8 @@ describe('DynamicPolicyResolverFactory', () => {
102105
step: 0,
103106
categories: new Set(),
104107
policies: { request: 'all_shards', response: 'agg_sum' },
105-
isKeyless: true
108+
isKeyless: true,
109+
subcommands: []
106110
}
107111
];
108112

@@ -128,7 +132,8 @@ describe('DynamicPolicyResolverFactory', () => {
128132
step: 1,
129133
categories: new Set(),
130134
policies: { request: 'all_shards', response: 'special' },
131-
isKeyless: false
135+
isKeyless: false,
136+
subcommands: []
132137
}
133138
];
134139

@@ -154,7 +159,8 @@ describe('DynamicPolicyResolverFactory', () => {
154159
step: 0,
155160
categories: new Set(),
156161
policies: { request: undefined, response: undefined },
157-
isKeyless: true
162+
isKeyless: true,
163+
subcommands: []
158164
}
159165
];
160166

@@ -182,7 +188,8 @@ describe('DynamicPolicyResolverFactory', () => {
182188
step: 0,
183189
categories: new Set(),
184190
policies: { request: undefined, response: undefined },
185-
isKeyless: true
191+
isKeyless: true,
192+
subcommands: []
186193
}
187194
];
188195

@@ -233,7 +240,8 @@ describe('DynamicPolicyResolverFactory', () => {
233240
step: 0,
234241
categories: new Set(),
235242
policies: { request: 'all_nodes', response: undefined },
236-
isKeyless: false
243+
isKeyless: false,
244+
subcommands: []
237245
},
238246
{
239247
name: 'partial-response',
@@ -244,7 +252,8 @@ describe('DynamicPolicyResolverFactory', () => {
244252
step: 0,
245253
categories: new Set(),
246254
policies: { request: undefined, response: 'agg_sum' },
247-
isKeyless: true
255+
isKeyless: true,
256+
subcommands: []
248257
}
249258
];
250259

packages/client/lib/commands/COMMAND.spec.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('COMMAND', () => {
1515
const testCases = [
1616
{
1717
name: 'without policies',
18-
input: ['ping', -1, [CommandFlags.STALE], 0, 0, 0, [CommandCategories.FAST], [], []] satisfies CommandRawReply,
18+
input: ['ping', -1, [CommandFlags.STALE], 0, 0, 0, [CommandCategories.FAST], [], [], []] satisfies CommandRawReply,
1919
expected: {
2020
name: 'ping',
2121
arity: -1,
@@ -25,12 +25,13 @@ describe('COMMAND', () => {
2525
step: 0,
2626
categories: new Set([CommandCategories.FAST]),
2727
policies: { request: undefined, response: undefined },
28-
isKeyless: true
28+
isKeyless: true,
29+
subcommands: []
2930
}
3031
},
3132
{
3233
name: 'with valid policies',
33-
input: ['dbsize', 1, [], 0, 0, 0, [], ['request_policy:all_shards', 'response_policy:agg_sum'], []] satisfies CommandRawReply,
34+
input: ['dbsize', 1, [], 0, 0, 0, [], ['request_policy:all_shards', 'response_policy:agg_sum'], [], []] satisfies CommandRawReply,
3435
expected: {
3536
name: 'dbsize',
3637
arity: 1,
@@ -40,12 +41,13 @@ describe('COMMAND', () => {
4041
step: 0,
4142
categories: new Set([]),
4243
policies: { request: 'all_shards', response: 'agg_sum' },
43-
isKeyless: true
44+
isKeyless: true,
45+
subcommands: []
4446
}
4547
},
4648
{
4749
name: 'with invalid policies',
48-
input: ['test', 0, [], 0, 0, 0, [], ['request_policy:invalid', 'response_policy:invalid'], ['some key specification']] satisfies CommandRawReply,
50+
input: ['test', 0, [], 0, 0, 0, [], ['request_policy:invalid', 'response_policy:invalid'], ['some key specification'], []] satisfies CommandRawReply,
4951
expected: {
5052
name: 'test',
5153
arity: 0,
@@ -55,12 +57,13 @@ describe('COMMAND', () => {
5557
step: 0,
5658
categories: new Set([]),
5759
policies: { request: undefined, response: undefined },
58-
isKeyless: false
60+
isKeyless: false,
61+
subcommands: []
5962
}
6063
},
6164
{
6265
name: 'with request policy only',
63-
input: ['test', 0, [], 0, 0, 0, [], ['request_policy:all_nodes'], ['some key specification']] satisfies CommandRawReply,
66+
input: ['test', 0, [], 0, 0, 0, [], ['request_policy:all_nodes'], ['some key specification'], []] satisfies CommandRawReply,
6467
expected: {
6568
name: 'test',
6669
arity: 0,
@@ -70,12 +73,13 @@ describe('COMMAND', () => {
7073
step: 0,
7174
categories: new Set([]),
7275
policies: { request: 'all_nodes', response: undefined },
73-
isKeyless: false
76+
isKeyless: false,
77+
subcommands: []
7478
}
7579
},
7680
{
7781
name: 'with response policy only',
78-
input: ['test', 0, [], 0, 0, 0, [], ['', 'response_policy:agg_max'], []] satisfies CommandRawReply,
82+
input: ['test', 0, [], 0, 0, 0, [], ['', 'response_policy:agg_max'], [], []] satisfies CommandRawReply,
7983
expected: {
8084
name: 'test',
8185
arity: 0,
@@ -85,12 +89,13 @@ describe('COMMAND', () => {
8589
step: 0,
8690
categories: new Set([]),
8791
policies: { request: undefined, response: 'agg_max' },
88-
isKeyless: true
92+
isKeyless: true,
93+
subcommands: []
8994
}
9095
},
9196
{
9297
name: 'with response policy only',
93-
input: ['test', 0, [], 0, 0, 0, [], ['', 'response_policy:agg_max'], []] satisfies CommandRawReply,
98+
input: ['test', 0, [], 0, 0, 0, [], ['', 'response_policy:agg_max'], [], []] satisfies CommandRawReply,
9499
expected: {
95100
name: 'test',
96101
arity: 0,
@@ -100,7 +105,8 @@ describe('COMMAND', () => {
100105
step: 0,
101106
categories: new Set([]),
102107
policies: { request: undefined, response: 'agg_max' },
103-
isKeyless: true
108+
isKeyless: true,
109+
subcommands: []
104110
}
105111
}
106112
];

0 commit comments

Comments
 (0)