rename repository to server repository in server context

This commit is contained in:
2025-03-27 10:38:02 -07:00
parent bba00eb067
commit bda46d6808
18 changed files with 128 additions and 148 deletions

View File

@@ -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);