fix test references after removal of addMockSystemToRepository

This commit is contained in:
2025-04-07 12:07:32 -07:00
parent dbb56f207d
commit 9c414be8ce
9 changed files with 73 additions and 102 deletions

View File

@@ -12,17 +12,9 @@ describe("QueryResolvers", () => {
const holder = setupTestServerHolder();
const context = setupTestServerContext();
async function addMockSystems() {
const systems = generateMockPassioSystems();
await Promise.all(systems.map(async (system) => {
await context.shuttleRepository.updateSystem(system);
}));
return systems;
}
describe("systems", () => {
it("returns systems from the repository", async () => {
const systems = await addMockSystems();
const systems = context.systems;
const query = `
query GetSystems
@@ -58,7 +50,7 @@ describe("QueryResolvers", () => {
`;
it("returns a system for an ID from the repository", async () => {
const systems = await addMockSystems();
const systems = context.systems;
const systemToGet = systems[1];
const response = await holder.testServer.executeOperation({
@@ -103,8 +95,8 @@ describe("QueryResolvers", () => {
it("returns correct data if the notification is scheduled", async () => {
// Arrange
const shuttle = await addMockShuttleToRepository(context.shuttleRepository, "1");
const stop = await addMockStopToRepository(context.shuttleRepository, "1")
const shuttle = await addMockShuttleToRepository(context.systems[0].shuttleRepository, "1");
const stop = await addMockStopToRepository(context.systems[0].shuttleRepository, "1")
const notification: ScheduledNotification = {
shuttleId: shuttle.id,
@@ -112,7 +104,7 @@ describe("QueryResolvers", () => {
deviceId: "1",
secondsThreshold: 240,
};
await context.notificationRepository.addOrUpdateNotification(notification);
await context.systems[0].notificationRepository.addOrUpdateNotification(notification);
const notificationLookup: any = {
...notification,