Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions e2e/grpc-example/__snapshots__/grpc-example.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
23 changes: 23 additions & 0 deletions e2e/grpc-example/grpc-example.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
7 changes: 6 additions & 1 deletion e2e/grpc-example/mesh.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Loading