Update mocked methods in tests, and test method names to match

This commit is contained in:
2025-09-26 14:56:49 -07:00
parent db263122a1
commit 7d886975b9
2 changed files with 9 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, jest } from "@jest/globals";
import { afterEach, beforeEach, describe, expect, it, jest } from "@jest/globals";
import { TimedApiBasedRepositoryLoader } from "../TimedApiBasedRepositoryLoader";
import { resetGlobalFetchMockJson } from "../../../testHelpers/fetchMockHelpers";
import { UnoptimizedInMemoryShuttleRepository } from "../../repositories/shuttle/UnoptimizedInMemoryShuttleRepository";
@@ -23,7 +23,7 @@ describe("TimedApiBasedRepositoryLoader", () => {
);
spies = {
fetchAndUpdateAll: jest.spyOn(mockLoader, 'fetchAndUpdateAll'),
updateAll: jest.spyOn(mockLoader, 'updateAll'),
};
Object.values(spies).forEach((spy: any) => {

View File

@@ -31,7 +31,7 @@ describe("ApiBasedShuttleRepositoryLoader", () => {
const systemId = "1";
describe("fetchAndUpdateAll", () => {
describe("updateAll", () => {
it("calls all the correct methods", async () => {
const spies = {
updateRouteDataForSystem: jest.spyOn(loader, "updateRouteDataForSystem"),
@@ -52,7 +52,7 @@ describe("ApiBasedShuttleRepositoryLoader", () => {
});
});
describe("fetchAndUpdateRouteDataForSystem", () => {
describe("updateRouteDataForSystem", () => {
it("updates route data in repository if response received", async () => {
// Arrange
// Test pruning
@@ -85,7 +85,7 @@ describe("ApiBasedShuttleRepositoryLoader", () => {
});
});
describe("fetchAndUpdateStopAndPolylineDataForRoutesWithSystemId", () => {
describe("updateStopAndPolylineDataForRoutesInSystem", () => {
it("updates stop and polyline data if response received", async () => {
// Arrange
// Test pruning of stops only
@@ -124,7 +124,7 @@ describe("ApiBasedShuttleRepositoryLoader", () => {
})
});
describe("fetchAndUpdateShuttleDataForSystem", () => {
describe("updateShuttleDataForSystem", () => {
it("updates shuttle data in repository if response received", async () => {
const shuttlesToPrune = generateMockShuttles();
await Promise.all(shuttlesToPrune.map(async (shuttle) => {
@@ -151,8 +151,8 @@ describe("ApiBasedShuttleRepositoryLoader", () => {
});
});
describe("fetchAndUpdateEtaDataForExistingStopsForSystem", () => {
it("calls fetchAndUpdateEtaDataForStopId for every stop in repository", async () => {
describe("updateEtaDataForExistingStopsForSystem", () => {
it("calls updateEtaDataForStopId for every stop in repository", async () => {
const spy = jest.spyOn(loader, "updateEtaDataForStopId");
const stops = generateMockStops();
@@ -170,7 +170,7 @@ describe("ApiBasedShuttleRepositoryLoader", () => {
});
});
describe("fetchAndUpdateEtaDataForStopId", () => {
describe("updateEtaDataForStopId", () => {
const stopId = "177666";
it("updates ETA data for stop id if response received", async () => {
updateGlobalFetchMockJson(fetchEtaDataSuccessfulResponse);