11import { buildSubgraphSchema } from '@apollo/subgraph' ;
22import { createInlineSigningKeyProvider , useJWT } from '@graphql-hive/gateway' ;
3- import {
4- createGatewayRuntime ,
5- useCustomFetch ,
6- } from '@graphql-hive/gateway-runtime' ;
7- import { composeLocalSchemasWithApollo } from '@internal/testing' ;
3+ import { createGatewayTester } from '@graphql-hive/gateway-testing' ;
84import { parse } from 'graphql' ;
9- import { createYoga } from 'graphql-yoga' ;
105import { describe , expect , it } from 'vitest' ;
116import { useAWSSigv4 } from '../src' ;
127
@@ -23,18 +18,14 @@ describe('AWS Sigv4 Incoming requests', () => {
2318 } ,
2419 } ,
2520 } ) ;
26- const subgraphServer = createYoga ( {
27- schema : subgraphSchema ,
28- } ) ;
2921 it ( 'validates incoming requests' , async ( ) => {
30- await using gw = createGatewayRuntime ( {
31- supergraph : composeLocalSchemasWithApollo ( [
22+ await using gw = createGatewayTester ( {
23+ subgraphs : [
3224 {
3325 name : 'subgraph' ,
3426 schema : subgraphSchema ,
35- url : 'http://localhost:4000/graphql' ,
3627 } ,
37- ] ) ,
28+ ] ,
3829 landingPage : false ,
3930 graphqlEndpoint : '/' ,
4031 plugins : ( ) => [
@@ -43,10 +34,6 @@ describe('AWS Sigv4 Incoming requests', () => {
4334 secretAccessKey : ( ) => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY' ,
4435 } ,
4536 } ) ,
46- useCustomFetch (
47- // @ts -expect-error - MeshFetch is not compatible with Yoga.fetch
48- subgraphServer . fetch ,
49- ) ,
5037 ] ,
5138 } ) ;
5239 const response = await gw . fetch (
@@ -59,7 +46,7 @@ describe('AWS Sigv4 Incoming requests', () => {
5946 Date : 'Mon, 29 Dec 2015 00:00:00 GMT' ,
6047 'content-type' : 'application/json' ,
6148 Host : 'sigv4examplegraphqlbucket.s3-eu-central-1.amazonaws.com' ,
62- 'Content-Length' : 30 ,
49+ 'Content-Length' : '30' ,
6350 'X-Amz-Content-Sha256' :
6451 '34c77dc7b593717e0231ac99a16ae3be5ee2e8d652bce6518738a6449dfd2647' ,
6552 'X-Amz-Date' : '20151229T000000Z' ,
@@ -82,14 +69,13 @@ describe('AWS Sigv4 Incoming requests', () => {
8269 } ) ;
8370 it ( 'works with JWT' , async ( ) => {
8471 const JWT_SECRET = 'a-string-secret-at-least-256-bits-long' ;
85- await using gw = createGatewayRuntime ( {
86- supergraph : composeLocalSchemasWithApollo ( [
72+ await using gw = createGatewayTester ( {
73+ subgraphs : [
8774 {
8875 name : 'subgraph' ,
8976 schema : subgraphSchema ,
90- url : 'http://localhost:4000/graphql' ,
9177 } ,
92- ] ) ,
78+ ] ,
9379 landingPage : false ,
9480 graphqlEndpoint : '/' ,
9581 plugins : ( ) => [
@@ -108,10 +94,6 @@ describe('AWS Sigv4 Incoming requests', () => {
10894 secretAccessKey : ( ) => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY' ,
10995 } ,
11096 } ) ,
111- useCustomFetch (
112- // @ts -expect-error - MeshFetch is not compatible with Yoga.fetch
113- subgraphServer . fetch ,
114- ) ,
11597 ] ,
11698 } ) ;
11799
@@ -125,7 +107,7 @@ describe('AWS Sigv4 Incoming requests', () => {
125107 Date : 'Mon, 29 Dec 2015 00:00:00 GMT' ,
126108 'content-type' : 'application/json' ,
127109 Host : 'sigv4examplegraphqlbucket.s3-eu-central-1.amazonaws.com' ,
128- 'Content-Length' : 30 ,
110+ 'Content-Length' : '30' ,
129111 'X-Amz-Content-Sha256' :
130112 '34c77dc7b593717e0231ac99a16ae3be5ee2e8d652bce6518738a6449dfd2647' ,
131113 'X-Amz-Date' : '20151229T000000Z' ,
0 commit comments