Fix missing cancelTask in mock SchedulerService implementations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
Fredrik Adelöw
2026-03-09 22:16:33 +01:00
parent 015668c5d2
commit 60eec59601
5 changed files with 8 additions and 3 deletions
@@ -246,6 +246,7 @@ Levenshtein
lightbox
Lightsail
limitranges
liveness
LocalStack
lockdown
lockfile
@@ -477,14 +477,12 @@ describe('PluginTaskManagerImpl', () => {
async databaseId => {
const { manager } = await init(databaseId);
const fn = jest.fn();
const promise = new Promise(resolve => fn.mockImplementation(resolve));
await manager.scheduleTask({
id: 'task1',
timeout: Duration.fromMillis(5000),
frequency: Duration.fromObject({ years: 1 }),
initialDelay: Duration.fromObject({ years: 1 }),
fn,
fn: jest.fn(),
scope: 'global',
});
@@ -95,6 +95,10 @@ export class MockSchedulerService implements SchedulerService {
});
}
async cancelTask(_id: string): Promise<void> {
// No-op in mock
}
async triggerTask(id: string): Promise<void> {
const task = this.#tasks.get(id);
if (!task) {
@@ -526,6 +526,7 @@ export namespace mockServices {
getScheduledTasks: jest.fn(),
scheduleTask: jest.fn(),
triggerTask: jest.fn(),
cancelTask: jest.fn(),
}));
}
@@ -34,6 +34,7 @@ describe('GiteaEntityProvider', () => {
triggerTask: jest.fn(),
scheduleTask: jest.fn(),
getScheduledTasks: jest.fn(),
cancelTask: jest.fn(),
};
const mockTaskRunner = {
run: jest.fn(),