mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
update remaining tests
This commit is contained in:
@@ -20,15 +20,15 @@ describe("UnoptimizedInMemoryRepository", () => {
|
|||||||
repository = new UnoptimizedInMemoryShuttleRepository();
|
repository = new UnoptimizedInMemoryShuttleRepository();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getStopsBySystemId", () => {
|
describe("getStops", () => {
|
||||||
test("gets stops by system ID", async () => {
|
test("gets all stops in the repository", async () => {
|
||||||
const mockStops = generateMockStops();
|
const mockStops = generateMockStops();
|
||||||
for (const stop of mockStops) {
|
for (const stop of mockStops) {
|
||||||
await repository.addOrUpdateStop(stop);
|
await repository.addOrUpdateStop(stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await repository.getStops();
|
const result = await repository.getStops();
|
||||||
expect(result).toEqual(mockStops.filter((stop) => stop.systemId === "sys1"));
|
expect(result).toEqual(mockStops);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("returns an empty list if there are no stops for the given system ID", async () => {
|
test("returns an empty list if there are no stops for the given system ID", async () => {
|
||||||
@@ -53,7 +53,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getRoutesBySystemId", () => {
|
describe("getRoutes", () => {
|
||||||
test("gets all routes for a specific system ID", async () => {
|
test("gets all routes for a specific system ID", async () => {
|
||||||
const mockRoutes = generateMockRoutes();
|
const mockRoutes = generateMockRoutes();
|
||||||
for (const route of mockRoutes) {
|
for (const route of mockRoutes) {
|
||||||
@@ -61,7 +61,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await repository.getRoutes();
|
const result = await repository.getRoutes();
|
||||||
expect(result).toEqual(mockRoutes.filter((route) => route.systemId === "sys1"));
|
expect(result).toEqual(mockRoutes);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("returns an empty list if there are no routes for the system ID", async () => {
|
test("returns an empty list if there are no routes for the system ID", async () => {
|
||||||
@@ -85,7 +85,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
|||||||
expect(result).toBeNull();
|
expect(result).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("getShuttlesBySystemId", () => {
|
describe("getShuttles", () => {
|
||||||
test("gets all shuttles for a specific system ID", async () => {
|
test("gets all shuttles for a specific system ID", async () => {
|
||||||
const mockShuttles = generateMockShuttles();
|
const mockShuttles = generateMockShuttles();
|
||||||
for (const shuttle of mockShuttles) {
|
for (const shuttle of mockShuttles) {
|
||||||
@@ -93,7 +93,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await repository.getShuttles();
|
const result = await repository.getShuttles();
|
||||||
expect(result).toEqual(mockShuttles.filter((sh) => sh.systemId === "sys1"));
|
expect(result).toEqual(mockShuttles);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("returns an empty list if there are no shuttles for the system ID", async () => {
|
test("returns an empty list if there are no shuttles for the system ID", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user