mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add queries for resolvers
This commit is contained in:
@@ -3,6 +3,13 @@ import { ApolloServer } from "@apollo/server";
|
|||||||
import { ServerContext } from "../../src/ServerContext";
|
import { ServerContext } from "../../src/ServerContext";
|
||||||
import { UnoptimizedInMemoryRepository } from "../../src/repositories/UnoptimizedInMemoryRepository";
|
import { UnoptimizedInMemoryRepository } from "../../src/repositories/UnoptimizedInMemoryRepository";
|
||||||
import { setUpTestServer } from "../testHelpers/apolloSetupHelpers";
|
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", () => {
|
describe("SystemResolvers", () => {
|
||||||
let testServer: ApolloServer<ServerContext>;
|
let testServer: ApolloServer<ServerContext>;
|
||||||
@@ -14,17 +21,50 @@ describe("SystemResolvers", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("routes", () => {
|
describe("routes", () => {
|
||||||
|
const query = `
|
||||||
|
query GetSystemRoutes($systemId: ID!) {
|
||||||
|
system(id: $systemId) {
|
||||||
|
routes {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
it("gets routes associated with system id", async () => {
|
it("gets routes associated with system id", async () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("stops", () => {
|
describe("stops", () => {
|
||||||
|
const query = `
|
||||||
|
query GetSystemStops($systemId: ID!) {
|
||||||
|
system(id: $systemId) {
|
||||||
|
stops {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
it("gets stops associated with system id", async () => {
|
it("gets stops associated with system id", async () => {
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("stop", () => {
|
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("gets the stop with the correct id", async () => {
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -39,11 +79,22 @@ describe("SystemResolvers", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("route", () => {
|
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("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", () => {
|
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("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", () => {
|
describe("shuttles", () => {
|
||||||
|
const query = `
|
||||||
|
query GetSystemShuttle($systemId: ID!) {
|
||||||
|
system(id: $systemId) {
|
||||||
|
shuttles {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
it("gets shuttles associated with system id", async () => {
|
it("gets shuttles associated with system id", async () => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user