mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
rename methods in getter repository
This commit is contained in:
@@ -27,12 +27,12 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
await repository.addOrUpdateStop(stop);
|
||||
}
|
||||
|
||||
const result = await repository.getStopsBySystemId("sys1");
|
||||
const result = await repository.getStops("sys1");
|
||||
expect(result).toEqual(mockStops.filter((stop) => stop.systemId === "sys1"));
|
||||
});
|
||||
|
||||
test("returns an empty list if there are no stops for the given system ID", async () => {
|
||||
const result = await repository.getStopsBySystemId("nonexistent-system");
|
||||
const result = await repository.getStops("nonexistent-system");
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -60,12 +60,12 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
await repository.addOrUpdateRoute(route);
|
||||
}
|
||||
|
||||
const result = await repository.getRoutesBySystemId("sys1");
|
||||
const result = await repository.getRoutes("sys1");
|
||||
expect(result).toEqual(mockRoutes.filter((route) => route.systemId === "sys1"));
|
||||
});
|
||||
|
||||
test("returns an empty list if there are no routes for the system ID", async () => {
|
||||
const result = await repository.getRoutesBySystemId("nonexistent-system");
|
||||
const result = await repository.getRoutes("nonexistent-system");
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -92,12 +92,12 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
await repository.addOrUpdateShuttle(shuttle);
|
||||
}
|
||||
|
||||
const result = await repository.getShuttlesBySystemId("sys1");
|
||||
const result = await repository.getShuttles("sys1");
|
||||
expect(result).toEqual(mockShuttles.filter((sh) => sh.systemId === "sys1"));
|
||||
});
|
||||
|
||||
test("returns an empty list if there are no shuttles for the system ID", async () => {
|
||||
const result = await repository.getShuttlesBySystemId("nonexistent-system");
|
||||
const result = await repository.getShuttles("nonexistent-system");
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -143,12 +143,12 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
await repository.addOrUpdateEta(eta);
|
||||
}
|
||||
|
||||
const result = await repository.getEtasForShuttleId("sh1");
|
||||
const result = await repository.getEtas("sh1");
|
||||
expect(result).toEqual(mockEtas.filter((eta) => eta.shuttleId === "sh1"));
|
||||
});
|
||||
|
||||
test("returns an empty list if there are no ETAs for the shuttle ID", async () => {
|
||||
const result = await repository.getEtasForShuttleId("nonexistent-shuttle");
|
||||
const result = await repository.getEtas("nonexistent-shuttle");
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -292,7 +292,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.addOrUpdateRoute(newRoute);
|
||||
|
||||
const result = await repository.getRoutesBySystemId("sys1");
|
||||
const result = await repository.getRoutes("sys1");
|
||||
expect(result).toEqual([newRoute]);
|
||||
});
|
||||
|
||||
@@ -305,7 +305,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
await repository.addOrUpdateRoute(existingRoute);
|
||||
await repository.addOrUpdateRoute(updatedRoute);
|
||||
|
||||
const result = await repository.getRoutesBySystemId("sys1");
|
||||
const result = await repository.getRoutes("sys1");
|
||||
expect(result).toEqual([updatedRoute]);
|
||||
});
|
||||
});
|
||||
@@ -317,7 +317,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.addOrUpdateShuttle(newShuttle);
|
||||
|
||||
const result = await repository.getShuttlesBySystemId("sys1");
|
||||
const result = await repository.getShuttles("sys1");
|
||||
expect(result).toEqual([newShuttle]);
|
||||
});
|
||||
|
||||
@@ -330,7 +330,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
await repository.addOrUpdateShuttle(existingShuttle);
|
||||
await repository.addOrUpdateShuttle(updatedShuttle);
|
||||
|
||||
const result = await repository.getShuttlesBySystemId("sys1");
|
||||
const result = await repository.getShuttles("sys1");
|
||||
expect(result).toEqual([updatedShuttle]);
|
||||
});
|
||||
});
|
||||
@@ -342,7 +342,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.addOrUpdateStop(newStop);
|
||||
|
||||
const result = await repository.getStopsBySystemId("sys1");
|
||||
const result = await repository.getStops("sys1");
|
||||
expect(result).toEqual([newStop]);
|
||||
});
|
||||
|
||||
@@ -355,7 +355,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
await repository.addOrUpdateStop(existingStop);
|
||||
await repository.addOrUpdateStop(updatedStop);
|
||||
|
||||
const result = await repository.getStopsBySystemId("sys1");
|
||||
const result = await repository.getStops("sys1");
|
||||
expect(result).toEqual([updatedStop]);
|
||||
});
|
||||
});
|
||||
@@ -392,7 +392,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.addOrUpdateEta(newEta);
|
||||
|
||||
const result = await repository.getEtasForShuttleId(newEta.shuttleId);
|
||||
const result = await repository.getEtas(newEta.shuttleId);
|
||||
expect(result).toEqual([newEta]);
|
||||
});
|
||||
|
||||
@@ -405,7 +405,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
await repository.addOrUpdateEta(existingEta);
|
||||
await repository.addOrUpdateEta(updatedEta);
|
||||
|
||||
const result = await repository.getEtasForShuttleId(existingEta.shuttleId);
|
||||
const result = await repository.getEtas(existingEta.shuttleId);
|
||||
expect(result).toEqual([updatedEta]);
|
||||
});
|
||||
});
|
||||
@@ -422,7 +422,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
const routeToRemove = mockRoutes[0];
|
||||
await repository.removeRouteIfExists(routeToRemove.id);
|
||||
|
||||
const remainingRoutes = await repository.getRoutesBySystemId(systemId);
|
||||
const remainingRoutes = await repository.getRoutes(systemId);
|
||||
expect(remainingRoutes).toHaveLength(mockRoutes.length - 1);
|
||||
});
|
||||
|
||||
@@ -436,7 +436,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.removeRouteIfExists("nonexistent-id");
|
||||
|
||||
const remainingRoutes = await repository.getRoutesBySystemId(systemId);
|
||||
const remainingRoutes = await repository.getRoutes(systemId);
|
||||
expect(remainingRoutes).toHaveLength(mockRoutes.length);
|
||||
});
|
||||
});
|
||||
@@ -453,7 +453,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
const shuttleToRemove = mockShuttles[0];
|
||||
await repository.removeShuttleIfExists(shuttleToRemove.id);
|
||||
|
||||
const remainingShuttles = await repository.getShuttlesBySystemId(systemId);
|
||||
const remainingShuttles = await repository.getShuttles(systemId);
|
||||
expect(remainingShuttles).toHaveLength(mockShuttles.length - 1);
|
||||
});
|
||||
|
||||
@@ -467,7 +467,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.removeShuttleIfExists("nonexistent-id");
|
||||
|
||||
const remainingShuttles = await repository.getShuttlesBySystemId(systemId);
|
||||
const remainingShuttles = await repository.getShuttles(systemId);
|
||||
expect(remainingShuttles).toHaveLength(mockShuttles.length);
|
||||
});
|
||||
});
|
||||
@@ -484,7 +484,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
const stopToRemove = mockStops[0];
|
||||
await repository.removeStopIfExists(stopToRemove.id);
|
||||
|
||||
const remainingStops = await repository.getStopsBySystemId(systemId);
|
||||
const remainingStops = await repository.getStops(systemId);
|
||||
expect(remainingStops).toHaveLength(mockStops.length - 1);
|
||||
});
|
||||
|
||||
@@ -498,7 +498,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.removeStopIfExists("nonexistent-id");
|
||||
|
||||
const remainingStops = await repository.getStopsBySystemId(systemId);
|
||||
const remainingStops = await repository.getStops(systemId);
|
||||
expect(remainingStops).toHaveLength(mockStops.length);
|
||||
});
|
||||
});
|
||||
@@ -580,7 +580,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.clearShuttleData();
|
||||
|
||||
const result = await repository.getShuttlesBySystemId("sys1");
|
||||
const result = await repository.getShuttles("sys1");
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -594,7 +594,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.clearEtaData();
|
||||
|
||||
const result = await repository.getEtasForShuttleId("shuttle1");
|
||||
const result = await repository.getEtas("shuttle1");
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -622,7 +622,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.clearRouteData();
|
||||
|
||||
const result = await repository.getRoutesBySystemId("sys1");
|
||||
const result = await repository.getRoutes("sys1");
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -636,7 +636,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.clearStopData();
|
||||
|
||||
const result = await repository.getStopsBySystemId("sys1");
|
||||
const result = await repository.getStops("sys1");
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user