add queries for resolvers

This commit is contained in:
2025-01-28 20:52:51 -08:00
parent f391b66b7c
commit b3cf13ec4e

View File

@@ -3,6 +3,13 @@ import { ApolloServer } from "@apollo/server";
import { ServerContext } from "../../src/ServerContext";
import { UnoptimizedInMemoryRepository } from "../../src/repositories/UnoptimizedInMemoryRepository";
import { setUpTestServer } from "../testHelpers/apolloSetupHelpers";
import { generateMockRoutes } from "../generators";
// const routes = await generateMockRoutes();
// await Promise.all(routes.map(async (route) => {
// route.systemId = mockSystem.id;
// await repository.addOrUpdateRoute(route);
// }));
describe("SystemResolvers", () => {
let testServer: ApolloServer<ServerContext>;
@@ -14,17 +21,50 @@ describe("SystemResolvers", () => {
});
describe("routes", () => {
const query = `
query GetSystemRoutes($systemId: ID!) {
system(id: $systemId) {
routes {
id
name
}
}
}
`;
it("gets routes associated with system id", async () => {
});
});
describe("stops", () => {
const query = `
query GetSystemStops($systemId: ID!) {
system(id: $systemId) {
stops {
id
name
}
}
}
`;
it("gets stops associated with system id", async () => {
});
});
describe("stop", () => {
const query = `
query GetSystemStop($systemId: ID!, $stopId: ID!) {
system(id: $systemId) {
stop(id: $stopId) {
id
name
}
}
}
`;
it("gets the stop with the correct id", async () => {
});
@@ -39,11 +79,22 @@ describe("SystemResolvers", () => {
});
describe("route", () => {
const query = `
query GetSystemRoute($systemId: ID!, $routeId: ID!) {
system(id: $systemId) {
route(id: $routeId) {
id
name
}
}
}
`;
it("gets the route with the correct id", async () => {
});
it("returns null if the stop isn't associated with the system", async () => {
it("returns null if the route isn't associated with the system", async () => {
});
@@ -53,11 +104,22 @@ describe("SystemResolvers", () => {
});
describe("shuttle", () => {
const query = `
query GetSystemShuttle($systemId: ID!, $shuttleId: ID!) {
system(id: $systemId) {
shuttle(id: $shuttleId) {
id
name
}
}
}
`;
it("gets the shuttle with the correct id", async () => {
});
it("returns null if the stop isn't associated with the system", async () => {
it("returns null if the shuttle isn't associated with the system", async () => {
});
@@ -67,6 +129,17 @@ describe("SystemResolvers", () => {
});
describe("shuttles", () => {
const query = `
query GetSystemShuttle($systemId: ID!) {
system(id: $systemId) {
shuttles {
id
name
}
}
}
`;
it("gets shuttles associated with system id", async () => {
});