|
1 | 1 | import { createTenv } from '@e2e/tenv';
|
2 | 2 |
|
3 |
| -const { service, serve, compose } = createTenv(__dirname); |
4 |
| - |
5 |
| -it('should compose the appropriate schema', async () => { |
6 |
| - const { result } = await compose({ |
7 |
| - services: [ |
8 |
| - await service('accounts'), |
9 |
| - await service('inventory'), |
10 |
| - await service('products'), |
11 |
| - await service('reviews'), |
12 |
| - ], |
| 3 | +it.concurrent('should compose the appropriate schema', async () => { |
| 4 | + await using tenv = createTenv(__dirname); |
| 5 | + await using accounts = await tenv.service('accounts'); |
| 6 | + await using inventory = await tenv.service('inventory'); |
| 7 | + await using products = await tenv.service('products'); |
| 8 | + await using reviews = await tenv.service('reviews'); |
| 9 | + await using composition = await tenv.compose({ |
| 10 | + services: [accounts, inventory, products, reviews], |
13 | 11 | maskServicePorts: true,
|
14 | 12 | });
|
15 |
| - expect(result).toMatchSnapshot(); |
| 13 | + expect(composition.supergraphSdl).toMatchSnapshot(); |
16 | 14 | });
|
17 | 15 |
|
18 | 16 | it.concurrent.each([
|
@@ -80,15 +78,15 @@ it.concurrent.each([
|
80 | 78 | `,
|
81 | 79 | },
|
82 | 80 | ])('should execute $name', async ({ query }) => {
|
83 |
| - const { output } = await compose({ |
| 81 | + await using tenv = createTenv(__dirname); |
| 82 | + await using accounts = await tenv.service('accounts'); |
| 83 | + await using inventory = await tenv.service('inventory'); |
| 84 | + await using products = await tenv.service('products'); |
| 85 | + await using reviews = await tenv.service('reviews'); |
| 86 | + await using composition = await tenv.compose({ |
84 | 87 | output: 'graphql',
|
85 |
| - services: [ |
86 |
| - await service('accounts'), |
87 |
| - await service('inventory'), |
88 |
| - await service('products'), |
89 |
| - await service('reviews'), |
90 |
| - ], |
| 88 | + services: [accounts, inventory, products, reviews], |
91 | 89 | });
|
92 |
| - const { execute } = await serve({ supergraph: output }); |
93 |
| - await expect(execute({ query })).resolves.toMatchSnapshot(); |
| 90 | + await using gw = await tenv.gateway({ supergraph: composition.supergraphPath }); |
| 91 | + await expect(gw.execute({ query })).resolves.toMatchSnapshot(); |
94 | 92 | });
|
0 commit comments