Skip to content

Commit 35e6438

Browse files
authored
Apply Prettier (#11111)
* flip .prettierignore to list ignored files * apply formatting to currently not-ignored files * upgrade prettier to v3 * apply agreed-up change to `"singleQuote": false` * move prettier config into file * format integration-tests * format config folder * ignore snap files per default * format the whole non-ignored repo * format `react` folder tests * format `react` folder
1 parent 6fde2e3 commit 35e6438

File tree

4 files changed

+34
-32
lines changed

4 files changed

+34
-32
lines changed

src/testing/matchers/index.d.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type {
22
ApolloClient,
33
DocumentNode,
44
OperationVariables,
5-
} from '../../core/index.js';
5+
} from "../../core/index.js";
66

77
interface ApolloCustomMatchers<R = void, T = {}> {
88
/**
@@ -14,13 +14,15 @@ interface ApolloCustomMatchers<R = void, T = {}> {
1414
/**
1515
* Used to determine if the Suspense cache has a cache entry.
1616
*/
17-
toHaveSuspenseCacheEntryUsing: T extends ApolloClient<any> ? ((
18-
query: DocumentNode,
19-
options?: {
20-
variables?: OperationVariables;
21-
queryKey?: string | number | any[];
22-
}
23-
) => R) : { error: "matcher needs to be called on an ApolloClient instance" };
17+
toHaveSuspenseCacheEntryUsing: T extends ApolloClient<any>
18+
? (
19+
query: DocumentNode,
20+
options?: {
21+
variables?: OperationVariables;
22+
queryKey?: string | number | any[];
23+
}
24+
) => R
25+
: { error: "matcher needs to be called on an ApolloClient instance" };
2426
}
2527

2628
declare global {

src/testing/matchers/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { expect } from '@jest/globals';
2-
import { toMatchDocument } from './toMatchDocument.js';
3-
import { toHaveSuspenseCacheEntryUsing } from './toHaveSuspenseCacheEntryUsing.js';
1+
import { expect } from "@jest/globals";
2+
import { toMatchDocument } from "./toMatchDocument.js";
3+
import { toHaveSuspenseCacheEntryUsing } from "./toHaveSuspenseCacheEntryUsing.js";
44

55
expect.extend({
66
toHaveSuspenseCacheEntryUsing,

src/testing/matchers/toHaveSuspenseCacheEntryUsing.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import type { MatcherFunction } from 'expect';
2-
import type { DocumentNode } from 'graphql';
3-
import type { OperationVariables } from '../../core/index.js';
4-
import { ApolloClient } from '../../core/index.js';
5-
import { canonicalStringify } from '../../cache/index.js';
6-
import { getSuspenseCache } from '../../react/cache/index.js';
7-
import type { CacheKey } from '../../react/cache/types.js';
1+
import type { MatcherFunction } from "expect";
2+
import type { DocumentNode } from "graphql";
3+
import type { OperationVariables } from "../../core/index.js";
4+
import { ApolloClient } from "../../core/index.js";
5+
import { canonicalStringify } from "../../cache/index.js";
6+
import { getSuspenseCache } from "../../react/cache/index.js";
7+
import type { CacheKey } from "../../react/cache/types.js";
88

99
export const toHaveSuspenseCacheEntryUsing: MatcherFunction<
1010
[
1111
query: DocumentNode,
1212
options: {
1313
variables?: OperationVariables;
1414
queryKey?: string | number | any[];
15-
}
15+
},
1616
]
1717
> = function (
1818
client,
1919
query,
2020
{ variables, queryKey = [] } = Object.create(null)
2121
) {
2222
if (!(client instanceof ApolloClient)) {
23-
throw new Error('Actual must be an instance of `ApolloClient`');
23+
throw new Error("Actual must be an instance of `ApolloClient`");
2424
}
2525

2626
const suspenseCache = getSuspenseCache(client);
@@ -30,13 +30,13 @@ export const toHaveSuspenseCacheEntryUsing: MatcherFunction<
3030
canonicalStringify(variables),
3131
...([] as any[]).concat(queryKey),
3232
];
33-
const queryRef = suspenseCache['queryRefs'].lookupArray(cacheKey)?.current;
33+
const queryRef = suspenseCache["queryRefs"].lookupArray(cacheKey)?.current;
3434

3535
return {
3636
pass: !!queryRef,
3737
message: () => {
3838
return `Expected suspense cache ${
39-
queryRef ? 'not ' : ''
39+
queryRef ? "not " : ""
4040
}to have cache entry using key`;
4141
},
4242
};

src/testing/matchers/toMatchDocument.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { checkDocument, print } from '../../utilities/index.js';
2-
import type { DocumentNode } from '../../core/index.js';
3-
import type { MatcherFunction } from 'expect';
1+
import { checkDocument, print } from "../../utilities/index.js";
2+
import type { DocumentNode } from "../../core/index.js";
3+
import type { MatcherFunction } from "expect";
44

55
export const toMatchDocument: MatcherFunction<[document: DocumentNode]> =
66
function (actual, document) {
7-
const hint = this.utils.matcherHint('toMatchDocument');
7+
const hint = this.utils.matcherHint("toMatchDocument");
88
const actualDocument = print(
99
validateDocument(
1010
actual,
1111
hint +
1212
`\n\n${this.utils.RECEIVED_COLOR(
13-
'received'
13+
"received"
1414
)} document must be a parsed document.`
1515
)
1616
);
@@ -19,7 +19,7 @@ export const toMatchDocument: MatcherFunction<[document: DocumentNode]> =
1919
document,
2020
hint +
2121
`\n\n${this.utils.EXPECTED_COLOR(
22-
'expected'
22+
"expected"
2323
)} document must be a parsed document.`
2424
)
2525
);
@@ -30,7 +30,7 @@ export const toMatchDocument: MatcherFunction<[document: DocumentNode]> =
3030
pass,
3131
message: () => {
3232
const hint = this.utils.matcherHint(
33-
'toMatchDocument',
33+
"toMatchDocument",
3434
undefined,
3535
undefined,
3636
{ isNot: this.isNot }
@@ -39,14 +39,14 @@ export const toMatchDocument: MatcherFunction<[document: DocumentNode]> =
3939
if (pass) {
4040
return (
4141
hint +
42-
'\n\n' +
43-
'Received:\n\n' +
42+
"\n\n" +
43+
"Received:\n\n" +
4444
this.utils.RECEIVED_COLOR(actualDocument)
4545
);
4646
}
4747

4848
return (
49-
hint + '\n\n' + this.utils.diff(expectedDocument, actualDocument)
49+
hint + "\n\n" + this.utils.diff(expectedDocument, actualDocument)
5050
);
5151
},
5252
};

0 commit comments

Comments
 (0)