mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
147 lines
3.0 KiB
TypeScript
147 lines
3.0 KiB
TypeScript
import { beforeEach, describe, it } from "@jest/globals";
|
|
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>;
|
|
let repository: UnoptimizedInMemoryRepository;
|
|
|
|
beforeEach(async () => {
|
|
testServer = setUpTestServer();
|
|
repository = new UnoptimizedInMemoryRepository();
|
|
});
|
|
|
|
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 () => {
|
|
|
|
});
|
|
|
|
it("returns null if the stop isn't associated with the system", async () => {
|
|
|
|
});
|
|
|
|
it("returns null if there is no stop", async () => {
|
|
|
|
});
|
|
});
|
|
|
|
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 route isn't associated with the system", async () => {
|
|
|
|
});
|
|
|
|
it("returns null if there is no route", async () => {
|
|
|
|
});
|
|
});
|
|
|
|
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 shuttle isn't associated with the system", async () => {
|
|
|
|
});
|
|
|
|
it("returns null if there is no shuttle", async () => {
|
|
|
|
});
|
|
});
|
|
|
|
describe("shuttles", () => {
|
|
const query = `
|
|
query GetSystemShuttle($systemId: ID!) {
|
|
system(id: $systemId) {
|
|
shuttles {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
it("gets shuttles associated with system id", async () => {
|
|
|
|
});
|
|
});
|
|
}); |