Files
project-inter-server/test/resolvers/OrderedStopResolverTests.test.ts
2025-01-23 15:49:43 -08:00

127 lines
2.8 KiB
TypeScript

import { beforeEach, describe, it } from "@jest/globals";
import { ApolloServer } from "@apollo/server";
import { UnoptimizedInMemoryRepository } from "../../src/repositories/UnoptimizedInMemoryRepository";
import { ServerContext } from "../../src/ServerContext";
import { setUpTestServer } from "../testHelpers/apolloSetupHelpers";
describe("OrderedStopResolvers", () => {
let apolloServer: ApolloServer<ServerContext>;
let repository: UnoptimizedInMemoryRepository;
beforeEach(async () => {
apolloServer = setUpTestServer();
repository = new UnoptimizedInMemoryRepository();
});
describe("nextStop", () => {
const query = `
query GetNextStop($systemId: ID!, $routeId: ID!, $stopId: ID!) {
system(id: $systemId) {
route(id: $routeId) {
orderedStop(forStopId: $stopId) {
nextStop {
routeId
stopId
}
}
}
}
}
`;
it("returns the next stop if it exists", async () => {
});
it("returns null if there is no next stop in the repository", async () => {
});
it("returns null if the current stop no longer exists", async () => {
});
});
describe("previousStop", () => {
const query = `
query GetNextStop($systemId: ID!, $routeId: ID!, $stopId: ID!) {
system(id: $systemId) {
route(id: $routeId) {
orderedStop(forStopId: $stopId) {
previousStop {
routeId
stopId
}
}
}
}
}
`;
it("returns the previous stop if it exists", async () => {
});
it("returns null if there is no previous stop in the repository", async () => {
});
it("returns null if the current stop no longer exists", async () => {
});
});
describe("route", () => {
// Note that there is no `orderedStop(forRouteId)` resolver,
// so fetch all ordered stops for a stop instead
const query = `
query GetNextStop($systemId: ID!, $stopId: ID!) {
system(id: $systemId) {
stop(id: $stopId) {
orderedStops {
route {
id
name
}
}
}
}
}
`;
});
it("returns the associated route if it exists", async () => {
});
it("returns null if the route doesn't exist", async () => {
});
describe("stop", () => {
const query = `
query GetNextStop($systemId: ID!, $routeId: ID!, $stopId: ID!) {
system(id: $systemId) {
route(id: $routeId) {
orderedStop(forStopId: $stopId) {
stop {
name
id
}
}
}
}
}
`;
it("returns the associated stop if it exists", async () => {
});
it("returns null if the stop doesn't exist", async () => {
});
});
});