Skip to content

Commit 7121006

Browse files
authored
fixed tests that were using print (#4341)
There were a few tests that broke due to changes to print params
1 parent e0c2425 commit 7121006

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

src/utilities/__tests__/buildASTSchema-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function expectASTNode(obj: Maybe<{ readonly astNode: Maybe<ASTNode> }>) {
6060
function expectExtensionASTNodes(obj: {
6161
readonly extensionASTNodes: ReadonlyArray<ASTNode>;
6262
}) {
63-
return expect(obj.extensionASTNodes.map(print).join('\n\n'));
63+
return expect(obj.extensionASTNodes.map((node) => print(node)).join('\n\n'));
6464
}
6565

6666
describe('Schema Builder', () => {

src/utilities/__tests__/extendSchema-test.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { printSchema } from '../printSchema';
3939
function expectExtensionASTNodes(obj: {
4040
readonly extensionASTNodes: ReadonlyArray<ASTNode>;
4141
}) {
42-
return expect(obj.extensionASTNodes.map(print).join('\n\n'));
42+
return expect(obj.extensionASTNodes.map((node) => print(node)).join('\n\n'));
4343
}
4444

4545
function expectASTNode(obj: Maybe<{ readonly astNode: Maybe<ASTNode> }>) {
@@ -51,10 +51,12 @@ function expectSchemaChanges(
5151
schema: GraphQLSchema,
5252
extendedSchema: GraphQLSchema,
5353
) {
54-
const schemaDefinitions = parse(printSchema(schema)).definitions.map(print);
54+
const schemaDefinitions = parse(printSchema(schema)).definitions.map((node) =>
55+
print(node),
56+
);
5557
return expect(
5658
parse(printSchema(extendedSchema))
57-
.definitions.map(print)
59+
.definitions.map((node) => print(node))
5860
.filter((def) => !schemaDefinitions.includes(def))
5961
.join('\n\n'),
6062
);

src/utilities/__tests__/separateOperations-test.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ describe('separateOperations', () => {
4949
}
5050
`);
5151

52-
const separatedASTs = mapValue(separateOperations(ast), print);
52+
const separatedASTs = mapValue(separateOperations(ast), (node) =>
53+
print(node),
54+
);
5355
expect(separatedASTs).to.deep.equal({
5456
'': dedent`
5557
{
@@ -128,7 +130,9 @@ describe('separateOperations', () => {
128130
}
129131
`);
130132

131-
const separatedASTs = mapValue(separateOperations(ast), print);
133+
const separatedASTs = mapValue(separateOperations(ast), (node) =>
134+
print(node),
135+
);
132136
expect(separatedASTs).to.deep.equal({
133137
One: dedent`
134138
query One {
@@ -178,7 +182,9 @@ describe('separateOperations', () => {
178182
}
179183
`);
180184

181-
const separatedASTs = mapValue(separateOperations(ast), print);
185+
const separatedASTs = mapValue(separateOperations(ast), (node) =>
186+
print(node),
187+
);
182188
expect(separatedASTs).to.deep.equal({
183189
'': dedent`
184190
{
@@ -215,7 +221,9 @@ describe('separateOperations', () => {
215221
type Bar
216222
`);
217223

218-
const separatedASTs = mapValue(separateOperations(ast), print);
224+
const separatedASTs = mapValue(separateOperations(ast), (node) =>
225+
print(node),
226+
);
219227
expect(separatedASTs).to.deep.equal({
220228
Foo: dedent`
221229
query Foo {
@@ -241,7 +249,9 @@ describe('separateOperations', () => {
241249
}
242250
`);
243251

244-
const separatedASTs = mapValue(separateOperations(ast), print);
252+
const separatedASTs = mapValue(separateOperations(ast), (node) =>
253+
print(node),
254+
);
245255
expect(separatedASTs).to.deep.equal({
246256
'': dedent`
247257
{

0 commit comments

Comments
 (0)