diff --git a/exchanges/graphcache/src/store/__snapshots__/store.test.ts.snap b/exchanges/graphcache/src/store/__snapshots__/store.test.ts.snap index 8e6e3a9067..3d688bc999 100644 --- a/exchanges/graphcache/src/store/__snapshots__/store.test.ts.snap +++ b/exchanges/graphcache/src/store/__snapshots__/store.test.ts.snap @@ -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"", } `; diff --git a/exchanges/graphcache/src/store/data.test.ts b/exchanges/graphcache/src/store/data.test.ts index 49351b3ffe..2289e323a2 100644 --- a/exchanges/graphcache/src/store/data.test.ts +++ b/exchanges/graphcache/src/store/data.test.ts @@ -149,7 +149,7 @@ describe('inspectFields', () => { "arguments": { "id": "1", }, - "fieldKey": "todo({\\"id\\":\\"1\\"})", + "fieldKey": "todo({"id":"1"})", "fieldName": "todo", }, { @@ -166,7 +166,7 @@ describe('inspectFields', () => { "arguments": { "id": "1", }, - "fieldKey": "hasTodo({\\"id\\":\\"1\\"})", + "fieldKey": "hasTodo({"id":"1"})", "fieldName": "hasTodo", }, ] diff --git a/exchanges/populate/src/populateExchange.test.ts b/exchanges/populate/src/populateExchange.test.ts index 9db9bb81dc..e0faece85d 100644 --- a/exchanges/populate/src/populateExchange.test.ts +++ b/exchanges/populate/src/populateExchange.test.ts @@ -271,7 +271,7 @@ describe('on query -> mutation', () => { __typename id text - createdAt(timezone: \\"GMT+1\\") + createdAt(timezone: "GMT+1") } }" `); diff --git a/packages/core/src/client.test.ts b/packages/core/src/client.test.ts index 956851baf6..f21a81f00a 100755 --- a/packages/core/src/client.test.ts +++ b/packages/core/src/client.test.ts @@ -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""` ); } }); diff --git a/packages/core/src/exchanges/__snapshots__/fetch.test.ts.snap b/packages/core/src/exchanges/__snapshots__/fetch.test.ts.snap index 92c83a27f8..1a593d89d9 100644 --- a/packages/core/src/exchanges/__snapshots__/fetch.test.ts.snap +++ b/packages/core/src/exchanges/__snapshots__/fetch.test.ts.snap @@ -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"}}"`; diff --git a/packages/core/src/gql.test.ts b/packages/core/src/gql.test.ts index 620bb0c38f..e886127eea 100644 --- a/packages/core/src/gql.test.ts +++ b/packages/core/src/gql.test.ts @@ -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'); diff --git a/packages/core/src/internal/__snapshots__/fetchSource.test.ts.snap b/packages/core/src/internal/__snapshots__/fetchSource.test.ts.snap index 42e11449dd..8ffc551a9d 100644 --- a/packages/core/src/internal/__snapshots__/fetchSource.test.ts.snap +++ b/packages/core/src/internal/__snapshots__/fetchSource.test.ts.snap @@ -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 {}, }, ], }, diff --git a/packages/core/src/internal/fetchOptions.test.ts b/packages/core/src/internal/fetchOptions.test.ts index 5664498d68..2bb3666931 100644 --- a/packages/core/src/internal/fetchOptions.test.ts +++ b/packages/core/src/internal/fetchOptions.test.ts @@ -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", @@ -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", @@ -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", @@ -240,7 +240,7 @@ describe('makeFetchOptions', () => { }); expect(form.get('map')).toMatchInlineSnapshot( - '"{\\"0\\":[\\"variables.file\\"]}"' + `"{"0":["variables.file"]}"` ); expect(form.get('0')).toBeInstanceOf(Blob); }); diff --git a/packages/core/src/utils/request.test.ts b/packages/core/src/utils/request.test.ts index f6079f9fd0..28879e6627 100644 --- a/packages/core/src/utils/request.test.ts +++ b/packages/core/src/utils/request.test.ts @@ -177,7 +177,7 @@ describe('stringifyDocument ', () => { .toMatchInlineSnapshot(` "{ field(arg: - \\"test #1\\") + "test #1") }" `); }); @@ -197,10 +197,10 @@ describe('stringifyDocument ', () => { .toMatchInlineSnapshot(` "{ field(arg: - \\"\\"\\" + """ hello #hello - \\"\\"\\") + """) }" `); });