Skip to content

Commit

Permalink
Fix issue with graphql-upload-client (#1838)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrearden committed Jul 28, 2020
1 parent 1997f71 commit cb717e6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/links/src/linkToExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const linkToExecutor = (link: ApolloLink) => <TReturn, TArgs, TContext>({
context: {
graphqlContext: context,
graphqlResolveInfo: info,
clientAwareness: {},
},
}) as Observable<FetchResult<TReturn>>
);
1 change: 1 addition & 0 deletions packages/links/src/linkToSubscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const linkToSubscriber = (link: ApolloLink) => async <TReturn, TArgs, TCo
context: {
graphqlContext: context,
graphqlResolveInfo: info,
clientAwareness: {},
},
}) as Observable<FetchResult<TReturn>>
);
26 changes: 18 additions & 8 deletions packages/links/tests/upload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ function testGraphqlMultipartRequest(query: string, port: number) {
}

describe('graphql upload', () => {
test('should return a file after uploading one', async () => {
let remoteServer: Server
let remotePort: number
let gatewayServer: Server
let gatewayPort: number

beforeAll(async () => {
const remoteSchema = makeExecutableSchema({
typeDefs: `
scalar Upload
Expand Down Expand Up @@ -86,8 +91,8 @@ describe('graphql upload', () => {
graphqlHTTP({ schema: remoteSchema }),
);

const remoteServer = await startServer(remoteApp);
const remotePort = (remoteServer.address() as AddressInfo).port;
remoteServer = await startServer(remoteApp);
remotePort = (remoteServer.address() as AddressInfo).port;

const nonExecutableSchema = buildSchema(`
scalar Upload
Expand Down Expand Up @@ -120,8 +125,16 @@ describe('graphql upload', () => {
graphqlHTTP({ schema: gatewaySchema }),
);

const gatewayServer = await startServer(gatewayApp);
const gatewayPort = (gatewayServer.address() as AddressInfo).port;
gatewayServer = await startServer(gatewayApp);
gatewayPort = (gatewayServer.address() as AddressInfo).port;
})

afterAll(async () => {
remoteServer.close();
gatewayServer.close();
})

test('should return a file after uploading one', async () => {
const query = `
mutation upload($file: Upload!) {
upload(file: $file)
Expand All @@ -134,8 +147,5 @@ describe('graphql upload', () => {
upload: 'abc',
},
});

remoteServer.close();
gatewayServer.close();
});
});

0 comments on commit cb717e6

Please sign in to comment.