Skip to content

Commit

Permalink
add test case for partially set options
Browse files Browse the repository at this point in the history
  • Loading branch information
n0v1 committed Apr 5, 2024
1 parent 27d6087 commit 1e37caa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
14 changes: 13 additions & 1 deletion packages/proto-loader/test/descriptor_type_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe('Descriptor types', () => {
const service = packageDefinition.Hello as proto_loader.ServiceDefinition
assert.deepStrictEqual(service.Hello.options, {
deprecated: true,
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
idempotency_level: 'NO_SIDE_EFFECTS',
uninterpreted_option: {
name: {
name_part: 'foo',
Expand All @@ -165,5 +165,17 @@ describe('Descriptor types', () => {
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
uninterpreted_option: []
})
assert.deepStrictEqual(service.HelloWithSomeOptions.options, {
deprecated: true,
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
uninterpreted_option: [],
'(google.api.http)': {
get: "/hello",
additional_bindings: {
body: '*',
get: '/hello-world'
}
},
})
})
});
12 changes: 11 additions & 1 deletion packages/proto-loader/test_protos/method_options.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ message MethodSignature {
service Hello {
rpc Hello (Empty) returns (Empty) {
option deprecated = true;
option idempotency_level = IDEMPOTENCY_UNKNOWN;
option idempotency_level = NO_SIDE_EFFECTS;
option uninterpreted_option = {
name: {
name_part: 'foo'
Expand All @@ -35,4 +35,14 @@ service Hello {
option (google.api.method_signature) = 'bar';
}
rpc HelloWithoutOptions (Empty) returns (Empty) {}
rpc HelloWithSomeOptions (Empty) returns (Empty) {
option deprecated = true;
option (google.api.http) = {
get: "/hello"
additional_bindings: {
get: "/hello-world"
body: "*"
}
};
}
}

0 comments on commit 1e37caa

Please sign in to comment.