mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Update function calls within tests where shuttle repositories are a dependency
This commit is contained in:
@@ -80,7 +80,7 @@ describe("ETANotificationScheduler", () => {
|
||||
// Act
|
||||
await notificationRepository.addOrUpdateNotification(notificationData1);
|
||||
await notificationRepository.addOrUpdateNotification(notificationData2);
|
||||
await shuttleRepository.addOrUpdateEta(eta);
|
||||
await shuttleRepository.addOrUpdateEtaFromExternalSource(eta);
|
||||
|
||||
// Assert
|
||||
// Wait for the callback to actually be called
|
||||
@@ -103,7 +103,7 @@ describe("ETANotificationScheduler", () => {
|
||||
|
||||
// Act
|
||||
await notificationRepository.addOrUpdateNotification(notificationData1);
|
||||
await shuttleRepository.addOrUpdateEta(eta);
|
||||
await shuttleRepository.addOrUpdateEtaFromExternalSource(eta);
|
||||
|
||||
// Assert
|
||||
await waitForMilliseconds(500);
|
||||
@@ -136,7 +136,7 @@ describe("ETANotificationScheduler", () => {
|
||||
|
||||
// Act
|
||||
await notificationRepository.addOrUpdateNotification(notificationData1);
|
||||
await shuttleRepository.addOrUpdateEta(eta);
|
||||
await shuttleRepository.addOrUpdateEtaFromExternalSource(eta);
|
||||
|
||||
// Assert
|
||||
// The notification should stay scheduled to be retried once
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("ShuttleResolvers", () => {
|
||||
const etas = generateMockEtas();
|
||||
await Promise.all(etas.map(async (eta) => {
|
||||
eta.shuttleId = shuttleId;
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEta(eta);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEtaFromExternalSource(eta);
|
||||
}));
|
||||
return etas;
|
||||
}
|
||||
@@ -146,9 +146,9 @@ describe("ShuttleResolvers", () => {
|
||||
const e1 = { ...generateMockEtas()[0], shuttleId: mockShuttle.id, stopId: "stA", secondsRemaining: 300 };
|
||||
const e2 = { ...generateMockEtas()[0], shuttleId: mockShuttle.id, stopId: "stB", secondsRemaining: 30 };
|
||||
const e3 = { ...generateMockEtas()[0], shuttleId: mockShuttle.id, stopId: "stC", secondsRemaining: 120 };
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEta(e1);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEta(e2);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEta(e3);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEtaFromExternalSource(e1);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEtaFromExternalSource(e2);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEtaFromExternalSource(e3);
|
||||
|
||||
const response = await holder.testServer.executeOperation({
|
||||
query,
|
||||
|
||||
@@ -106,7 +106,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.systems[0].shuttleRepository.addOrUpdateEta(eta);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEtaFromExternalSource(eta);
|
||||
}));
|
||||
|
||||
const response = await getResponseForQuery(query);
|
||||
@@ -128,9 +128,9 @@ describe("StopResolvers", () => {
|
||||
const e1 = { ...generateMockEtas()[0], stopId: mockStop.id, shuttleId: "shA", secondsRemaining: 240 };
|
||||
const e2 = { ...generateMockEtas()[0], stopId: mockStop.id, shuttleId: "shB", secondsRemaining: 60 };
|
||||
const e3 = { ...generateMockEtas()[0], stopId: mockStop.id, shuttleId: "shC", secondsRemaining: 120 };
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEta(e1);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEta(e2);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEta(e3);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEtaFromExternalSource(e1);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEtaFromExternalSource(e2);
|
||||
await context.systems[0].shuttleRepository.addOrUpdateEtaFromExternalSource(e3);
|
||||
|
||||
const response = await getResponseForQuery(query);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user