mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add test case for nonexistent callback
This commit is contained in:
@@ -257,6 +257,17 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
expect(mockCallback).toHaveBeenCalledWith(mockEtas[0]); // First notification
|
||||
expect(mockCallback).not.toHaveBeenCalledWith(mockEtas[mockEtas.length - 1]); // Last notification
|
||||
});
|
||||
|
||||
test("does nothing if the listener doesn't exist", async () => {
|
||||
const mockCallback = jest.fn();
|
||||
repository.subscribeToEtaUpdates(mockCallback);
|
||||
|
||||
const mockEtas = generateMockEtas();
|
||||
|
||||
repository.unsubscribeFromEtaUpdates(() => {});
|
||||
await repository.addOrUpdateEta(mockEtas[0]);
|
||||
expect(mockCallback).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getOrderedStopByRouteAndStopId", () => {
|
||||
|
||||
Reference in New Issue
Block a user