mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add test cases and documentation for functions
This commit is contained in:
@@ -17,7 +17,23 @@ export interface GetterRepository {
|
||||
getEtasForShuttleId(shuttleId: string): Promise<IEta[]>;
|
||||
getEtasForStopId(stopId: string): Promise<IEta[]>;
|
||||
getEtaForShuttleAndStopId(shuttleId: string, stopId: string): Promise<IEta | null>;
|
||||
subscribeToEtaChanges(listener: (eta: IEta) => void): Promise<void>;
|
||||
|
||||
/**
|
||||
* Subscribe to all updates in ETA data.
|
||||
* The subscriber persists even if the ETA data does not
|
||||
* exist within the repository, and may fire again
|
||||
* if ETA data is restored.
|
||||
* @param listener
|
||||
*/
|
||||
subscribeToEtaChanges(
|
||||
listener: (eta: IEta) => void,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
* Unsubscribe from all ETA updates for the given callback.
|
||||
* Callback must be passed by reference.
|
||||
* @param listener
|
||||
*/
|
||||
unsubscribeFromEtaChanges(listener: (eta: IEta) => void): Promise<void>;
|
||||
|
||||
getOrderedStopByRouteAndStopId(routeId: string, stopId: string): Promise<IOrderedStop | null>;
|
||||
|
||||
@@ -225,6 +225,14 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("subscribeToEtaChanges", () => {
|
||||
test("notifies listener if the eta has changed")
|
||||
});
|
||||
|
||||
describe("unsubscribeFromEtaChanges", () => {
|
||||
|
||||
});
|
||||
|
||||
describe("getOrderedStopByRouteAndStopId", () => {
|
||||
test("gets an ordered stop by route ID and stop ID", async () => {
|
||||
const mockOrderedStops = generateMockOrderedStops();
|
||||
|
||||
Reference in New Issue
Block a user