mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
update query resolver tests to modify the context
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { generateMockPassioSystems } from "../testHelpers/mockDataGenerators";
|
||||
import { setupTestServerContext, setupTestServerHolder } from "../testHelpers/apolloTestServerHelpers";
|
||||
import {
|
||||
buildSystemForTesting,
|
||||
setupTestServerContext,
|
||||
setupTestServerHolder
|
||||
} from "../testHelpers/apolloTestServerHelpers";
|
||||
import assert = require("node:assert");
|
||||
import { addMockShuttleToRepository, addMockStopToRepository } from "../testHelpers/repositorySetupHelpers";
|
||||
import { ScheduledNotification } from "../../src/repositories/NotificationRepository";
|
||||
@@ -50,6 +54,13 @@ describe("QueryResolvers", () => {
|
||||
`;
|
||||
|
||||
it("returns a system for an ID from the repository", async () => {
|
||||
context.systems = [
|
||||
buildSystemForTesting(),
|
||||
buildSystemForTesting(),
|
||||
];
|
||||
context.findSystemById = (_: string) => context.systems[1];
|
||||
context.systems[1].id = "test-id";
|
||||
|
||||
const systems = context.systems;
|
||||
const systemToGet = systems[1];
|
||||
|
||||
@@ -69,6 +80,8 @@ describe("QueryResolvers", () => {
|
||||
});
|
||||
|
||||
it("returns null if there is no system", async () => {
|
||||
context.findSystemById = (_: string) => null;
|
||||
|
||||
const response = await holder.testServer.executeOperation({
|
||||
query,
|
||||
variables: {
|
||||
|
||||
Reference in New Issue
Block a user