Skip to content

Commit

Permalink
fix(PM): close with timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
iapolya committed Oct 9, 2024
1 parent 26ca36f commit 4aa404f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/promo-manager/core/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ export class Controller {
this.stateActions.removeFromQueue(slug);

this.updateProgressInfo(slug);

this.triggerNextPromo();
};

cancelPromo = (slug: Nullable<PromoSlug>, closeActiveTimeout = 0) => {
Expand Down
22 changes: 22 additions & 0 deletions src/promo-manager/tests/controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,17 @@ describe('trigger subscribe', () => {
expect(callback).toHaveBeenCalledTimes(1);
});

it('finish with timeout -> 1 update', async () => {
await controller.requestStart('boardPoll');

const callback = jest.fn();
controller.subscribe(callback);

await controller.finishPromo('boardPoll', 500);

expect(callback).toHaveBeenCalledTimes(1);
});

it('cancel -> 1 update', async () => {
await controller.requestStart('boardPoll');

Expand All @@ -271,6 +282,17 @@ describe('trigger subscribe', () => {
expect(callback).toHaveBeenCalledTimes(1);
});

it('cancel with timeout -> 1 update', async () => {
await controller.requestStart('boardPoll');

const callback = jest.fn();
controller.subscribe(callback);

await controller.cancelPromo('boardPoll', 500);

expect(callback).toHaveBeenCalledTimes(1);
});

it('skipPromo -> 1 update', async () => {
await controller.requestStart('boardPoll');

Expand Down

0 comments on commit 4aa404f

Please sign in to comment.