Skip to content

Commit

Permalink
chore: update references from schemaProxy to textSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
alessbell committed May 15, 2024
1 parent 2e3f962 commit 7c9ed4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import graphqlSchema from "../../../schema.graphql";

const staticSchema = makeExecutableSchema({ typeDefs: graphqlSchema });

export let schemaProxy = createTestSchema(staticSchema, {
export let testSchema = createTestSchema(staticSchema, {
resolvers: {
Query: {
products: () => [
Expand All @@ -27,12 +27,12 @@ export let schemaProxy = createTestSchema(staticSchema, {
},
});

export function replaceSchema(newSchema: typeof schemaProxy) {
const oldSchema = schemaProxy;
schemaProxy = newSchema;
export function replaceSchema(newSchema: typeof testSchema) {
const oldSchema = testSchema;
testSchema = newSchema;

function restore() {
schemaProxy = oldSchema;
testSchema = oldSchema;
}

return Object.assign(restore, {
Expand All @@ -50,7 +50,7 @@ export const handlers = [
const result = await execute({
document,
operationName,
schema: schemaProxy,
schema: testSchema,
variableValues: variables,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { Products } from "../../products";
import { server } from "../mocks/server";
import { makeClient } from "../../client";
import { replaceSchema, schemaProxy } from "../mocks/handlers";
import { replaceSchema, testSchema } from "../mocks/handlers";

// The following server set-up, reset and teardown would normally be
// done in a `setupTests.ts` file. Since we're using Jest to run both
Expand Down Expand Up @@ -39,7 +39,7 @@ describe("Products", () => {
});

test("allows resolvers to be updated via .add", async () => {
schemaProxy.add({
testSchema.add({
resolvers: {
Query: {
products: () => {
Expand All @@ -63,7 +63,7 @@ describe("Products", () => {
});

test("allows resolvers to be updated via .fork and replaceSchema", async () => {
const newSchema = schemaProxy.fork({
const newSchema = testSchema.fork({
resolvers: {
Query: {
products: () => {
Expand All @@ -89,7 +89,7 @@ describe("Products", () => {
});

test("handles test schema resetting via .reset", async () => {
schemaProxy.reset();
testSchema.reset();

render(makeClient());

Expand Down

0 comments on commit 7c9ed4e

Please sign in to comment.