mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
rename repository to server repository in server context
This commit is contained in:
@@ -18,10 +18,10 @@ describe("EtaResolvers", () => {
|
||||
let expectedEta: IEta;
|
||||
|
||||
beforeEach(async () => {
|
||||
mockSystem = await addMockSystemToRepository(context.repository);
|
||||
mockShuttle = await addMockShuttleToRepository(context.repository, mockSystem.id);
|
||||
mockStop = await addMockStopToRepository(context.repository, mockSystem.id);
|
||||
expectedEta = await addMockEtaToRepository(context.repository, mockStop.id, mockShuttle.id);
|
||||
mockSystem = await addMockSystemToRepository(context.shuttleRepository);
|
||||
mockShuttle = await addMockShuttleToRepository(context.shuttleRepository, mockSystem.id);
|
||||
mockStop = await addMockStopToRepository(context.shuttleRepository, mockSystem.id);
|
||||
expectedEta = await addMockEtaToRepository(context.shuttleRepository, mockStop.id, mockShuttle.id);
|
||||
});
|
||||
|
||||
async function getResponseForEtaQuery(query: string) {
|
||||
@@ -32,9 +32,8 @@ describe("EtaResolvers", () => {
|
||||
shuttleId: mockShuttle.id,
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ describe("MutationResolvers", () => {
|
||||
|
||||
|
||||
it("adds a notification to the notification service", async () => {
|
||||
const system = await addMockSystemToRepository(context.repository);
|
||||
const shuttle = await addMockShuttleToRepository(context.repository, system.id);
|
||||
const stop = await addMockStopToRepository(context.repository, system.id);
|
||||
const system = await addMockSystemToRepository(context.shuttleRepository);
|
||||
const shuttle = await addMockShuttleToRepository(context.shuttleRepository, system.id);
|
||||
const stop = await addMockStopToRepository(context.shuttleRepository, system.id);
|
||||
|
||||
const notificationInput = {
|
||||
deviceId: "1",
|
||||
@@ -76,9 +76,9 @@ describe("MutationResolvers", () => {
|
||||
});
|
||||
|
||||
it("adds a notification with the default seconds threshold if none is provided", async () => {
|
||||
const system = await addMockSystemToRepository(context.repository);
|
||||
const shuttle = await addMockShuttleToRepository(context.repository, system.id);
|
||||
const stop = await addMockStopToRepository(context.repository, system.id);
|
||||
const system = await addMockSystemToRepository(context.shuttleRepository);
|
||||
const shuttle = await addMockShuttleToRepository(context.shuttleRepository, system.id);
|
||||
const stop = await addMockStopToRepository(context.shuttleRepository, system.id);
|
||||
|
||||
const notificationInput = {
|
||||
deviceId: "1",
|
||||
@@ -97,8 +97,8 @@ describe("MutationResolvers", () => {
|
||||
});
|
||||
|
||||
it("fails if the shuttle ID doesn't exist", async () => {
|
||||
const system = await addMockSystemToRepository(context.repository);
|
||||
const stop = await addMockStopToRepository(context.repository, system.id);
|
||||
const system = await addMockSystemToRepository(context.shuttleRepository);
|
||||
const stop = await addMockStopToRepository(context.shuttleRepository, system.id);
|
||||
|
||||
const notificationInput = {
|
||||
deviceId: "1",
|
||||
@@ -110,8 +110,8 @@ describe("MutationResolvers", () => {
|
||||
});
|
||||
|
||||
it("fails if the stop ID doesn't exist", async () => {
|
||||
const system = await addMockSystemToRepository(context.repository);
|
||||
const shuttle = await addMockShuttleToRepository(context.repository, system.id);
|
||||
const system = await addMockSystemToRepository(context.shuttleRepository);
|
||||
const shuttle = await addMockShuttleToRepository(context.shuttleRepository, system.id);
|
||||
|
||||
const notificationInput = {
|
||||
deviceId: "1",
|
||||
@@ -140,9 +140,9 @@ describe("MutationResolvers", () => {
|
||||
`
|
||||
|
||||
it("removes the notification from the notification service", async () => {
|
||||
const system = await addMockSystemToRepository(context.repository);
|
||||
const shuttle = await addMockShuttleToRepository(context.repository, system.id);
|
||||
const stop = await addMockStopToRepository(context.repository, system.id);
|
||||
const system = await addMockSystemToRepository(context.shuttleRepository);
|
||||
const shuttle = await addMockShuttleToRepository(context.shuttleRepository, system.id);
|
||||
const stop = await addMockStopToRepository(context.shuttleRepository, system.id);
|
||||
|
||||
const notificationInput: any = {
|
||||
deviceId: "1",
|
||||
|
||||
@@ -14,13 +14,13 @@ describe("OrderedStopResolvers", () => {
|
||||
let mockStops: IStop[];
|
||||
|
||||
beforeEach(async () => {
|
||||
mockSystem = await addMockSystemToRepository(context.repository);
|
||||
mockRoute = await addMockRouteToRepository(context.repository, mockSystem.id);
|
||||
mockSystem = await addMockSystemToRepository(context.shuttleRepository);
|
||||
mockRoute = await addMockRouteToRepository(context.shuttleRepository, mockSystem.id);
|
||||
|
||||
mockStops = generateMockStops();
|
||||
await Promise.all(mockStops.map(async (mockStop) => {
|
||||
mockStop.systemId = mockSystem.id;
|
||||
await context.repository.addOrUpdateStop(mockStop);
|
||||
await context.shuttleRepository.addOrUpdateStop(mockStop);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -38,8 +38,8 @@ describe("OrderedStopResolvers", () => {
|
||||
// Link the stops together
|
||||
orderedStops[0].nextStop = orderedStops[1];
|
||||
orderedStops[1].previousStop = orderedStops[0];
|
||||
await context.repository.addOrUpdateOrderedStop(orderedStops[0]);
|
||||
await context.repository.addOrUpdateOrderedStop(orderedStops[1]);
|
||||
await context.shuttleRepository.addOrUpdateOrderedStop(orderedStops[0]);
|
||||
await context.shuttleRepository.addOrUpdateOrderedStop(orderedStops[1]);
|
||||
return orderedStops;
|
||||
}
|
||||
|
||||
@@ -68,9 +68,8 @@ describe("OrderedStopResolvers", () => {
|
||||
stopId,
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -94,7 +93,7 @@ describe("OrderedStopResolvers", () => {
|
||||
it("returns null if there is no next stop in the repository", async () => {
|
||||
const orderedStops = await setUpOrderedStopsInRepository();
|
||||
orderedStops[0].nextStop = undefined;
|
||||
await context.repository.addOrUpdateOrderedStop(orderedStops[0]);
|
||||
await context.shuttleRepository.addOrUpdateOrderedStop(orderedStops[0]);
|
||||
|
||||
const response = await getResponseForNextStopQuery(orderedStops[0].stopId);
|
||||
|
||||
@@ -105,7 +104,7 @@ describe("OrderedStopResolvers", () => {
|
||||
|
||||
it("returns null if the next stop object no longer exists", async () => {
|
||||
const orderedStops = await setUpOrderedStopsInRepository();
|
||||
await context.repository.removeStopIfExists(orderedStops[1].stopId);
|
||||
await context.shuttleRepository.removeStopIfExists(orderedStops[1].stopId);
|
||||
|
||||
const response = await getResponseForNextStopQuery(orderedStops[0].stopId);
|
||||
|
||||
@@ -140,9 +139,8 @@ describe("OrderedStopResolvers", () => {
|
||||
stopId,
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -165,7 +163,7 @@ describe("OrderedStopResolvers", () => {
|
||||
it("returns null if there is no previous stop in the repository", async () => {
|
||||
const orderedStops = await setUpOrderedStopsInRepository();
|
||||
orderedStops[1].previousStop = undefined;
|
||||
await context.repository.addOrUpdateOrderedStop(orderedStops[1]);
|
||||
await context.shuttleRepository.addOrUpdateOrderedStop(orderedStops[1]);
|
||||
|
||||
const response = await getResponseForPreviousStopQuery(orderedStops[1].stopId);
|
||||
|
||||
@@ -176,7 +174,7 @@ describe("OrderedStopResolvers", () => {
|
||||
|
||||
it("returns null if the current stop no longer exists", async () => {
|
||||
const orderedStops = await setUpOrderedStopsInRepository();
|
||||
await context.repository.removeStopIfExists(orderedStops[0].stopId);
|
||||
await context.shuttleRepository.removeStopIfExists(orderedStops[0].stopId);
|
||||
|
||||
const response = await getResponseForPreviousStopQuery(orderedStops[1].stopId);
|
||||
|
||||
@@ -214,9 +212,8 @@ describe("OrderedStopResolvers", () => {
|
||||
stopId,
|
||||
}
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -226,7 +223,7 @@ describe("OrderedStopResolvers", () => {
|
||||
orderedStops[0].stopId = mockStops[0].id;
|
||||
|
||||
// Add one stop only
|
||||
await context.repository.addOrUpdateOrderedStop(orderedStops[0]);
|
||||
await context.shuttleRepository.addOrUpdateOrderedStop(orderedStops[0]);
|
||||
|
||||
const response = await getResponseForRouteQuery(orderedStops[1].stopId);
|
||||
|
||||
@@ -265,16 +262,15 @@ describe("OrderedStopResolvers", () => {
|
||||
stopId,
|
||||
}
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
it("returns the associated stop if it exists", async () => {
|
||||
const orderedStops = await setUpOrderedStopsInRepository();
|
||||
orderedStops[0].stopId = mockStops[0].id;
|
||||
await context.repository.addOrUpdateOrderedStop(orderedStops[0]);
|
||||
await context.shuttleRepository.addOrUpdateOrderedStop(orderedStops[0]);
|
||||
|
||||
const response = await getResponseForStopQuery(orderedStops[0].stopId);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ describe("QueryResolvers", () => {
|
||||
async function addMockSystems() {
|
||||
const systems = generateMockSystems();
|
||||
await Promise.all(systems.map(async (system) => {
|
||||
await context.repository.addOrUpdateSystem(system);
|
||||
await context.shuttleRepository.addOrUpdateSystem(system);
|
||||
}));
|
||||
return systems;
|
||||
}
|
||||
@@ -36,9 +36,8 @@ describe("QueryResolvers", () => {
|
||||
const response = await holder.testServer.executeOperation({
|
||||
query,
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
},
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
|
||||
assert(response.body.kind === "single");
|
||||
@@ -68,9 +67,8 @@ describe("QueryResolvers", () => {
|
||||
id: systemToGet.id,
|
||||
}
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
|
||||
assert(response.body.kind === "single");
|
||||
@@ -85,9 +83,8 @@ describe("QueryResolvers", () => {
|
||||
id: "nonexistent-id",
|
||||
}
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
|
||||
assert(response.body.kind === "single");
|
||||
@@ -106,8 +103,8 @@ describe("QueryResolvers", () => {
|
||||
|
||||
it("returns correct data if the notification is scheduled", async () => {
|
||||
// Arrange
|
||||
const shuttle = await addMockShuttleToRepository(context.repository, "1");
|
||||
const stop = await addMockStopToRepository(context.repository, "1")
|
||||
const shuttle = await addMockShuttleToRepository(context.shuttleRepository, "1");
|
||||
const stop = await addMockStopToRepository(context.shuttleRepository, "1")
|
||||
|
||||
const notification: NotificationSchedulingArguments = {
|
||||
shuttleId: shuttle.id,
|
||||
|
||||
@@ -18,11 +18,11 @@ describe("RouteResolvers", () => {
|
||||
let mockStop: IStop;
|
||||
|
||||
beforeEach(async () => {
|
||||
mockSystem = await addMockSystemToRepository(context.repository);
|
||||
mockSystem = await addMockSystemToRepository(context.shuttleRepository);
|
||||
const systemId = mockSystem.id;
|
||||
|
||||
mockRoute = await addMockRouteToRepository(context.repository, systemId);
|
||||
mockStop = await addMockStopToRepository(context.repository, systemId);
|
||||
mockRoute = await addMockRouteToRepository(context.shuttleRepository, systemId);
|
||||
mockStop = await addMockStopToRepository(context.shuttleRepository, systemId);
|
||||
});
|
||||
|
||||
|
||||
@@ -48,9 +48,8 @@ describe("RouteResolvers", () => {
|
||||
routeId: mockRoute.id,
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,7 +58,7 @@ describe("RouteResolvers", () => {
|
||||
const expectedShuttle = expectedShuttles[0];
|
||||
expectedShuttle.systemId = mockSystem.id;
|
||||
expectedShuttle.routeId = mockRoute.id;
|
||||
await context.repository.addOrUpdateShuttle(expectedShuttle);
|
||||
await context.shuttleRepository.addOrUpdateShuttle(expectedShuttle);
|
||||
|
||||
const response = await getResponseForShuttlesQuery();
|
||||
|
||||
@@ -104,9 +103,8 @@ describe("RouteResolvers", () => {
|
||||
stopId: mockStop.id,
|
||||
}
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,7 +113,7 @@ describe("RouteResolvers", () => {
|
||||
const expectedOrderedStop = orderedStops[0];
|
||||
expectedOrderedStop.stopId = mockStop.id;
|
||||
expectedOrderedStop.routeId = mockRoute.id;
|
||||
await context.repository.addOrUpdateOrderedStop(expectedOrderedStop);
|
||||
await context.shuttleRepository.addOrUpdateOrderedStop(expectedOrderedStop);
|
||||
|
||||
const response = await getResponseForOrderedStopQuery();
|
||||
|
||||
@@ -132,9 +130,9 @@ describe("RouteResolvers", () => {
|
||||
const expectedOrderedStop = orderedStops[0];
|
||||
expectedOrderedStop.stopId = mockStop.id;
|
||||
expectedOrderedStop.routeId = mockRoute.id;
|
||||
await context.repository.addOrUpdateOrderedStop(expectedOrderedStop);
|
||||
await context.shuttleRepository.addOrUpdateOrderedStop(expectedOrderedStop);
|
||||
|
||||
await context.repository.removeStopIfExists(mockStop.id);
|
||||
await context.shuttleRepository.removeStopIfExists(mockStop.id);
|
||||
|
||||
const response = await getResponseForOrderedStopQuery();
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ describe("ShuttleResolvers", () => {
|
||||
let mockShuttle: IShuttle;
|
||||
|
||||
beforeEach(async () => {
|
||||
mockSystem = await addMockSystemToRepository(context.repository);
|
||||
mockShuttle = await addMockShuttleToRepository(context.repository,
|
||||
mockSystem = await addMockSystemToRepository(context.shuttleRepository);
|
||||
mockShuttle = await addMockShuttleToRepository(context.shuttleRepository,
|
||||
mockSystem.id);
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ describe("ShuttleResolvers", () => {
|
||||
const etas = generateMockEtas();
|
||||
await Promise.all(etas.map(async (eta) => {
|
||||
eta.shuttleId = shuttleId;
|
||||
await context.repository.addOrUpdateEta(eta);
|
||||
await context.shuttleRepository.addOrUpdateEta(eta);
|
||||
}));
|
||||
return etas;
|
||||
}
|
||||
@@ -56,9 +56,8 @@ describe("ShuttleResolvers", () => {
|
||||
stopId: mockEta.stopId,
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
},
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
|
||||
// Assert
|
||||
@@ -77,9 +76,8 @@ describe("ShuttleResolvers", () => {
|
||||
stopId: "nonexistent-stop",
|
||||
}
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
|
||||
// Assert
|
||||
@@ -114,9 +112,8 @@ describe("ShuttleResolvers", () => {
|
||||
shuttleId: mockShuttle.id,
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
|
||||
assert(response.body.kind === "single");
|
||||
@@ -133,9 +130,8 @@ describe("ShuttleResolvers", () => {
|
||||
shuttleId: mockShuttle.id,
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
|
||||
assert(response.body.kind === "single");
|
||||
@@ -172,15 +168,14 @@ describe("ShuttleResolvers", () => {
|
||||
shuttleId: mockShuttle.id,
|
||||
}
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
it("returns the route if it exists", async () => {
|
||||
const mockRoute = generateMockRoutes()[0];
|
||||
await context.repository.addOrUpdateRoute(mockRoute);
|
||||
await context.shuttleRepository.addOrUpdateRoute(mockRoute);
|
||||
|
||||
const response = await getResponseForQuery();
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ describe("StopResolvers", () => {
|
||||
let mockSystem: ISystem;
|
||||
|
||||
beforeEach(async () => {
|
||||
mockSystem = await addMockSystemToRepository(context.repository);
|
||||
mockStop = await addMockStopToRepository(context.repository, mockSystem.id);
|
||||
mockSystem = await addMockSystemToRepository(context.shuttleRepository);
|
||||
mockStop = await addMockStopToRepository(context.shuttleRepository, mockSystem.id);
|
||||
})
|
||||
|
||||
async function getResponseForQuery(query: string) {
|
||||
@@ -25,9 +25,7 @@ describe("StopResolvers", () => {
|
||||
stopId: mockStop.id,
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,7 +49,7 @@ describe("StopResolvers", () => {
|
||||
mockOrderedStops = mockOrderedStops.filter((orderedStop) => orderedStop.stopId === mockOrderedStops[0].stopId);
|
||||
await Promise.all(mockOrderedStops.map(async orderedStop => {
|
||||
orderedStop.stopId = mockStop.id;
|
||||
await context.repository.addOrUpdateOrderedStop(orderedStop);
|
||||
await context.shuttleRepository.addOrUpdateOrderedStop(orderedStop);
|
||||
}));
|
||||
|
||||
const response = await getResponseForQuery(query);
|
||||
@@ -88,7 +86,7 @@ describe("StopResolvers", () => {
|
||||
mockEtas = mockEtas.filter((eta) => eta.stopId === mockEtas[0].stopId);
|
||||
await Promise.all(mockEtas.map(async eta => {
|
||||
eta.stopId = mockStop.id;
|
||||
await context.repository.addOrUpdateEta(eta);
|
||||
await context.shuttleRepository.addOrUpdateEta(eta);
|
||||
}));
|
||||
|
||||
const response = await getResponseForQuery(query);
|
||||
|
||||
@@ -17,7 +17,7 @@ describe("SystemResolvers", () => {
|
||||
let mockSystem: ISystem;
|
||||
|
||||
beforeEach(async () => {
|
||||
mockSystem = await addMockSystemToRepository(context.repository);
|
||||
mockSystem = await addMockSystemToRepository(context.shuttleRepository);
|
||||
});
|
||||
|
||||
// TODO: Consolidate these into one single method taking an object
|
||||
@@ -29,7 +29,7 @@ describe("SystemResolvers", () => {
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository
|
||||
shuttleRepository: context.shuttleRepository
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -50,7 +50,7 @@ describe("SystemResolvers", () => {
|
||||
const expectedRoutes = generateMockRoutes();
|
||||
await Promise.all(expectedRoutes.map(async (route) => {
|
||||
route.systemId = mockSystem.id;
|
||||
await context.repository.addOrUpdateRoute(route);
|
||||
await context.shuttleRepository.addOrUpdateRoute(route);
|
||||
}));
|
||||
|
||||
const response = await getResponseFromQueryNeedingSystemId(query);
|
||||
@@ -78,7 +78,7 @@ describe("SystemResolvers", () => {
|
||||
const expectedStops = generateMockStops();
|
||||
await Promise.all(expectedStops.map(async (stop) => {
|
||||
stop.systemId = mockSystem.id;
|
||||
await context.repository.addOrUpdateStop(stop);
|
||||
await context.shuttleRepository.addOrUpdateStop(stop);
|
||||
}));
|
||||
|
||||
const response = await getResponseFromQueryNeedingSystemId(query);
|
||||
@@ -111,13 +111,13 @@ describe("SystemResolvers", () => {
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
shuttleRepository: context.shuttleRepository,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
it("gets the stop with the correct id", async () => {
|
||||
const mockStop = await addMockStopToRepository(context.repository, mockSystem.id);
|
||||
const mockStop = await addMockStopToRepository(context.shuttleRepository, mockSystem.id);
|
||||
|
||||
const response = await getResponseForStopQuery(mockStop.id);
|
||||
|
||||
@@ -133,9 +133,9 @@ describe("SystemResolvers", () => {
|
||||
...mockSystem,
|
||||
id: "2",
|
||||
}
|
||||
await context.repository.addOrUpdateSystem(updatedSystem);
|
||||
await context.shuttleRepository.addOrUpdateSystem(updatedSystem);
|
||||
|
||||
const mockStop = await addMockStopToRepository(context.repository, updatedSystem.id);
|
||||
const mockStop = await addMockStopToRepository(context.shuttleRepository, updatedSystem.id);
|
||||
|
||||
const response = await getResponseForStopQuery(mockStop.id);
|
||||
|
||||
@@ -177,14 +177,12 @@ describe("SystemResolvers", () => {
|
||||
routeId,
|
||||
},
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
});
|
||||
}
|
||||
|
||||
it("gets the route with the correct id", async () => {
|
||||
const mockRoute = await addMockRouteToRepository(context.repository, mockSystem.id);
|
||||
const mockRoute = await addMockRouteToRepository(context.shuttleRepository, mockSystem.id);
|
||||
|
||||
const response = await getResponseForRouteQuery(mockRoute.id);
|
||||
|
||||
@@ -201,9 +199,9 @@ describe("SystemResolvers", () => {
|
||||
...mockSystem,
|
||||
id: "2",
|
||||
}
|
||||
await context.repository.addOrUpdateSystem(updatedSystem);
|
||||
await context.shuttleRepository.addOrUpdateSystem(updatedSystem);
|
||||
|
||||
const mockRoute = await addMockRouteToRepository(context.repository, updatedSystem.id);
|
||||
const mockRoute = await addMockRouteToRepository(context.shuttleRepository, updatedSystem.id);
|
||||
|
||||
const response = await getResponseForRouteQuery(mockRoute.id);
|
||||
|
||||
@@ -245,14 +243,13 @@ describe("SystemResolvers", () => {
|
||||
shuttleId: shuttleId,
|
||||
}
|
||||
}, {
|
||||
contextValue: {
|
||||
repository: context.repository,
|
||||
}
|
||||
contextValue: context
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
it("gets the shuttle with the correct id", async () => {
|
||||
const mockShuttle = await addMockShuttleToRepository(context.repository, mockSystem.id);
|
||||
const mockShuttle = await addMockShuttleToRepository(context.shuttleRepository, mockSystem.id);
|
||||
|
||||
const response = await getResponseForShuttleQuery(mockShuttle.id);
|
||||
|
||||
@@ -268,9 +265,9 @@ describe("SystemResolvers", () => {
|
||||
...mockSystem,
|
||||
id: "2",
|
||||
}
|
||||
await context.repository.addOrUpdateSystem(updatedSystem);
|
||||
await context.shuttleRepository.addOrUpdateSystem(updatedSystem);
|
||||
|
||||
const mockShuttle = await addMockShuttleToRepository(context.repository, updatedSystem.id);
|
||||
const mockShuttle = await addMockShuttleToRepository(context.shuttleRepository, updatedSystem.id);
|
||||
|
||||
const response = await getResponseForShuttleQuery(mockShuttle.id);
|
||||
|
||||
@@ -308,7 +305,7 @@ describe("SystemResolvers", () => {
|
||||
const expectedShuttles = generateMockShuttles();
|
||||
await Promise.all(expectedShuttles.map(async (shuttle) => {
|
||||
shuttle.systemId = mockSystem.id;
|
||||
await context.repository.addOrUpdateShuttle(shuttle);
|
||||
await context.shuttleRepository.addOrUpdateShuttle(shuttle);
|
||||
}));
|
||||
|
||||
const response = await getResponseFromQueryNeedingSystemId(query);
|
||||
|
||||
Reference in New Issue
Block a user