diff --git a/e2e/grpc-example/__snapshots__/grpc-example.test.ts.snap b/e2e/grpc-example/__snapshots__/grpc-example.test.ts.snap index 5d93b7e5e40b9..b572da7646051 100644 --- a/e2e/grpc-example/__snapshots__/grpc-example.test.ts.snap +++ b/e2e/grpc-example/__snapshots__/grpc-example.test.ts.snap @@ -313,6 +313,16 @@ input SearchByCastRequest_Input @join__type(graph: MOVIES) { " `; +exports[`gRPC Example gets empty movies correctly: get-empty-movies-grpc-example-result 1`] = ` +{ + "data": { + "exampleGetMovies": { + "result": [], + }, + }, +} +`; + exports[`gRPC Example gets movies correctly: get-movies-grpc-example-result 1`] = ` { "data": { diff --git a/e2e/grpc-example/grpc-example.test.ts b/e2e/grpc-example/grpc-example.test.ts index 1dbc46dbe9593..8eee891c1662a 100644 --- a/e2e/grpc-example/grpc-example.test.ts +++ b/e2e/grpc-example/grpc-example.test.ts @@ -15,6 +15,29 @@ describe('gRPC Example', () => { const { result } = await compose({ services: [movies], maskServicePorts: true }); expect(result).toMatchSnapshot(); }); + it('gets empty movies correctly', async () => { + const { output } = await compose({ services: [movies], output: 'graphql' }); + const { execute } = await serve({ supergraph: output }); + // Genre HORROR does not exist in mock data + const query = /* GraphQL */ ` + query GetMovies { + exampleGetMovies(input: { movie: { genre: HORROR, year: 2015 } }) { + result { + name + year + rating + cast + time { + seconds + } + } + } + } + `; + await expect(execute({ query })).resolves.toMatchSnapshot( + 'get-empty-movies-grpc-example-result', + ); + }); it('gets movies correctly', async () => { const { output } = await compose({ services: [movies], output: 'graphql' }); const { execute } = await serve({ supergraph: output }); diff --git a/e2e/grpc-example/mesh.config.ts b/e2e/grpc-example/mesh.config.ts index 738369d57ecb3..4f6413762f3a4 100644 --- a/e2e/grpc-example/mesh.config.ts +++ b/e2e/grpc-example/mesh.config.ts @@ -17,7 +17,12 @@ export const composeConfig = defineComposeConfig({ someKey: 'someValue', connection_type: '{context.headers.connection}', }, - source: './services/movies/proto/service.proto', + source: { + file: './services/movies/proto/service.proto', + load: { + defaults: true, + }, + }, }), transforms: [ createNamingConventionTransform({