Skip to content

Commit

Permalink
Fix snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Sep 14, 2024
1 parent 9396b1a commit a1ab43f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 29 deletions.
4 changes: 2 additions & 2 deletions exchanges/graphcache/src/store/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('inspectFields', () => {
"arguments": {
"id": "1",
},
"fieldKey": "todo({\\"id\\":\\"1\\"})",
"fieldKey": "todo({"id":"1"})",
"fieldName": "todo",
},
{
Expand All @@ -166,7 +166,7 @@ describe('inspectFields', () => {
"arguments": {
"id": "1",
},
"fieldKey": "hasTodo({\\"id\\":\\"1\\"})",
"fieldKey": "hasTodo({"id":"1"})",
"fieldName": "hasTodo",
},
]
Expand Down
2 changes: 1 addition & 1 deletion exchanges/populate/src/populateExchange.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ describe('on query -> mutation', () => {
__typename
id
text
createdAt(timezone: \\"GMT+1\\")
createdAt(timezone: "GMT+1")
}
}"
`);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('executeQuery', () => {
expect(true).toBeFalsy();
} catch (e: any) {
expect(e.message).toMatchInlineSnapshot(
`"Expected operation of type \\"query\\" but found \\"mutation\\""`
`"Expected operation of type "query" but found "mutation""`
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,4 @@ exports[`on success > returns response data 1`] = `
}
`;

exports[`on success > returns response data 2`] = `"{\\"operationName\\":\\"getUser\\",\\"query\\":\\"query getUser($name: String) {\\\\n user(name: $name) {\\\\n id\\\\n firstName\\\\n lastName\\\\n }\\\\n}\\",\\"variables\\":{\\"name\\":\\"Clara\\"}}"`;
exports[`on success > returns response data 2`] = `"{"operationName":"getUser","query":"query getUser($name: String) {\\n user(name: $name) {\\n id\\n firstName\\n lastName\\n }\\n}","variables":{"name":"Clara"}}"`;
Original file line number Diff line number Diff line change
Expand Up @@ -758,23 +758,7 @@ exports[`on success > uses the mock fetch if given 1`] = `
"results": [
{
"type": "return",
"value": {
"headers": {
"get": [Function],
},
"status": 200,
"text": [MockFunction spy] {
"calls": [
[],
],
"results": [
{
"type": "return",
"value": "{\\"status\\":200,\\"data\\":{\\"data\\":{\\"user\\":1200}}}",
},
],
},
},
"value": Promise {},
},
],
},
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/internal/fetchOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('makeFetchOptions', () => {
const body = makeFetchBody(queryOperation);
expect(makeFetchOptions(queryOperation, body)).toMatchInlineSnapshot(`
{
"body": "{\\"operationName\\":\\"getUser\\",\\"query\\":\\"query getUser($name: String) {\\\\n user(name: $name) {\\\\n id\\\\n firstName\\\\n lastName\\\\n }\\\\n}\\",\\"variables\\":{\\"name\\":\\"Clara\\"}}",
"body": "{"operationName":"getUser","query":"query getUser($name: String) {\\n user(name: $name) {\\n id\\n firstName\\n lastName\\n }\\n}","variables":{"name":"Clara"}}",
"headers": {
"accept": "application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed",
"content-type": "application/json",
Expand All @@ -158,7 +158,7 @@ describe('makeFetchOptions', () => {

expect(makeFetchOptions(operation, body)).toMatchInlineSnapshot(`
{
"body": "{\\"operationName\\":\\"getUser\\",\\"query\\":\\"query getUser($name: String) {\\\\n user(name: $name) {\\\\n id\\\\n firstName\\\\n lastName\\\\n }\\\\n}\\",\\"variables\\":{\\"name\\":\\"Clara\\"}}",
"body": "{"operationName":"getUser","query":"query getUser($name: String) {\\n user(name: $name) {\\n id\\n firstName\\n lastName\\n }\\n}","variables":{"name":"Clara"}}",
"headers": {
"accept": "application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed",
"content-type": "application/json",
Expand All @@ -180,7 +180,7 @@ describe('makeFetchOptions', () => {

expect(makeFetchOptions(operation, body)).toMatchInlineSnapshot(`
{
"body": "{\\"operationName\\":\\"getUser\\",\\"query\\":\\"query getUser($name: String) {\\\\n user(name: $name) {\\\\n id\\\\n firstName\\\\n lastName\\\\n }\\\\n}\\",\\"variables\\":{\\"name\\":\\"Clara\\"}}",
"body": "{"operationName":"getUser","query":"query getUser($name: String) {\\n user(name: $name) {\\n id\\n firstName\\n lastName\\n }\\n}","variables":{"name":"Clara"}}",
"headers": {
"accept": "application/graphql-response+json, application/graphql+json, application/json, text/event-stream, multipart/mixed",
"content-type": "application/json",
Expand Down Expand Up @@ -240,7 +240,7 @@ describe('makeFetchOptions', () => {
});

expect(form.get('map')).toMatchInlineSnapshot(
'"{\\"0\\":[\\"variables.file\\"]}"'
`"{"0":["variables.file"]}"`
);
expect(form.get('0')).toBeInstanceOf(Blob);
});
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/utils/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe('stringifyDocument ', () => {
.toMatchInlineSnapshot(`
"{
field(arg:
\\"test #1\\")
"test #1")
}"
`);
});
Expand All @@ -197,10 +197,10 @@ describe('stringifyDocument ', () => {
.toMatchInlineSnapshot(`
"{
field(arg:
\\"\\"\\"
"""
hello
#hello
\\"\\"\\")
""")
}"
`);
});
Expand Down

0 comments on commit a1ab43f

Please sign in to comment.