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 cd52647
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 38 deletions.
14 changes: 7 additions & 7 deletions exchanges/graphcache/src/store/__snapshots__/store.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

exports[`Store with storage > should be able to persist embedded data 1`] = `
{
"Query%2eappointment({\\"id\\":\\"1\\"}).__typename": "\\"Appointment\\"",
"Query%2eappointment({\\"id\\":\\"1\\"}).info": "\\"urql meeting\\"",
"Query.appointment({\\"id\\":\\"1\\"})": ":\\"Query.appointment({\\\\\\"id\\\\\\":\\\\\\"1\\\\\\"})\\"",
"Query%2eappointment({"id":"1"}).__typename": ""Appointment"",
"Query%2eappointment({"id":"1"}).info": ""urql meeting"",
"Query.appointment({"id":"1"})": ":"Query.appointment({\\"id\\":\\"1\\"})"",
}
`;

exports[`Store with storage > should be able to store and rehydrate data 1`] = `
{
"Appointment:1.__typename": "\\"Appointment\\"",
"Appointment:1.id": "\\"1\\"",
"Appointment:1.info": "\\"urql meeting\\"",
"Query.appointment({\\"id\\":\\"1\\"})": ":\\"Appointment:1\\"",
"Appointment:1.__typename": ""Appointment"",
"Appointment:1.id": ""1"",
"Appointment:1.info": ""urql meeting"",
"Query.appointment({"id":"1"})": ":"Appointment:1"",
}
`;
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"}}"`;
4 changes: 2 additions & 2 deletions packages/core/src/gql.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { parse, print } from '@0no-co/graphql.web';
import { vi, expect, it, beforeEach, SpyInstance } from 'vitest';
import { vi, expect, it, beforeEach, MockInstance } from 'vitest';

import { gql } from './gql';
import { keyDocument } from './utils';

let warn: SpyInstance;
let warn: MockInstance;

beforeEach(() => {
warn = vi.spyOn(console, 'warn');
Expand Down
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 cd52647

Please sign in to comment.