Skip to content

Commit aa5ba99

Browse files
committed
pr edits
1 parent 31b9fa5 commit aa5ba99

4 files changed

Lines changed: 19 additions & 15 deletions

File tree

packages/apollo-language-server/src/engine/operations/listServices.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const LIST_SERVICES = gql`
99
services {
1010
graphID
1111
graphVariant
12-
__typename
1312
name
1413
url
1514
updatedAt

packages/apollo/src/commands/service/__tests__/check.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ let mockedConsoleLogOriginal: Console["log"] | null = null;
5050
*/
5151
let mockedConsoleLogValues: string[] | null = null;
5252

53+
// TODO: the following two functions are identical to the ones found in list.test.ts
54+
// we are choosing to duplicate them for now, because with a shared helper function,
55+
// jest overwrites console log output as the tests are run in parallel
56+
5357
/**
5458
* Mock and capture `console.log` and `stdout.write`s. Return them in that order as a single string.
5559
*

packages/apollo/src/commands/service/__tests__/list.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ let mockedConsoleLogOriginal: Console["log"] | null = null;
4040
*/
4141
let mockedConsoleLogValues: string[] | null = null;
4242

43+
// TODO: the following two functions are identical to the ones found in check.test.ts
44+
// we are choosing to duplicate them for now, because with a shared helper function,
45+
// jest overwrites console log output as the tests are run in parallel
46+
4347
/**
4448
* Mock and capture `console.log` and `stdout.write`s. Return them in that order as a single string.
4549
*
@@ -201,9 +205,7 @@ describe("service:list", () => {
201205

202206
expect.assertions(2);
203207

204-
await expect(
205-
ServiceList.run([...cliKeyParameter])
206-
).resolves.not.toThrow();
208+
await expect(ServiceList.run(cliKeyParameter)).resolves.not.toThrow();
207209

208210
// Inline snapshots don't work here due to https://github.com/facebook/jest/issues/6744.
209211
expect(uncaptureApplicationOutput()).toMatchSnapshot();
@@ -217,9 +219,7 @@ describe("service:list", () => {
217219

218220
expect.assertions(2);
219221

220-
await expect(
221-
ServiceList.run([...cliKeyParameter])
222-
).resolves.not.toThrow();
222+
await expect(ServiceList.run(cliKeyParameter)).resolves.not.toThrow();
223223

224224
// Inline snapshots don't work here due to https://github.com/facebook/jest/issues/6744.
225225
expect(uncaptureApplicationOutput()).toMatchSnapshot();

packages/apollo/src/commands/service/list.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { GraphQLSchema } from "graphql";
44
import sortBy from "lodash.sortby";
55
import { table } from "heroku-cli-util";
66
import moment from "moment";
7-
import { ApolloConfig, isServiceProject } from "apollo-language-server";
7+
import {
8+
ApolloConfig,
9+
isServiceProject,
10+
DefaultEngineConfig
11+
} from "apollo-language-server";
812
import chalk from "chalk";
913
import {
1014
ListServices_service_implementingServices,
@@ -53,9 +57,7 @@ function formatHumanReadable({
5357
>(implementingServices.services, [service => service.name.toUpperCase()]);
5458

5559
table(
56-
[...sortedImplementingServices.map(formatImplementingService)].filter(
57-
Boolean
58-
),
60+
sortedImplementingServices.map(formatImplementingService).filter(Boolean),
5961
{
6062
columns: [
6163
{ key: "name", label: "Name" },
@@ -72,9 +74,7 @@ function formatHumanReadable({
7274
}
7375
);
7476
const serviceListUrlEnding = `/graph/${graphName}/service-list`;
75-
const targetUrl = frontendUrl
76-
? `${frontendUrl}${serviceListUrlEnding}`
77-
: `https://engine.apollographql.com${serviceListUrlEnding}`;
77+
const targetUrl = `${frontendUrl}${serviceListUrlEnding}`;
7878
result += `\n\nView full details at: ${targetUrl}`;
7979
}
8080
return result;
@@ -161,7 +161,8 @@ export default class ServiceList extends ProjectCommand {
161161
formatHumanReadable({
162162
implementingServices: taskOutput.implementingServices,
163163
graphName: taskOutput.config.name,
164-
frontendUrl: taskOutput.config.engine.frontend
164+
frontendUrl:
165+
taskOutput.config.engine.frontend || DefaultEngineConfig.frontend
165166
})
166167
);
167168
}

0 commit comments

Comments
 (0)