Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with graphql-upload-client #1838

Merged
merged 1 commit into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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();
});
});