Skip to content

Commit 3f08897

Browse files
committed
Added a few scenarios to the test case
Signed-off-by: Amulya Varote <[email protected]>
1 parent a013a69 commit 3f08897

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

test/actor/DemoActorReminderImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default class DemoActorReminderImpl extends AbstractActor implements Demo
1818
counter = 0;
1919

2020
async init(): Promise<string> {
21-
await super.registerActorReminder("my-reminder-name", Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 2 }),
21+
await super.registerActorReminder("my-reminder-name", Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 3 }),
2222
undefined, 123);
2323
return "Actor Initialized";
2424
}

test/actor/DemoActorTimerTtlImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class DemoActorTimerTtlImpl extends AbstractActor implements Demo
2121
await super.registerActorTimer("my-timer-name", "countBy",
2222
Temporal.Duration.from({ seconds: 2 }), //dueTime
2323
Temporal.Duration.from({ seconds: 2 }), //period
24-
Temporal.Duration.from({ seconds: 1 }), //ttl
24+
Temporal.Duration.from({ seconds: 3 }), //ttl
2525
100);
2626
return "Actor Initialized";
2727
}

test/e2e/actors.http.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,22 @@ describe('http/actors', () => {
198198
const res1 = await actor.getCounter();
199199
expect(res1).toEqual(100);
200200

201+
// Every 1 second the timer gets called again, so the count attribute should change
202+
// we check this twice to ensure correct calling
203+
await (new Promise(resolve => setTimeout(resolve, 1000)));
204+
const res2 = await actor.getCounter();
205+
expect(res2).toEqual(100);
206+
await (new Promise(resolve => setTimeout(resolve, 1000)));
207+
const res3 = await actor.getCounter();
208+
expect(res3).toEqual(200);
209+
201210
// Stop the timer
202211
await actor.removeTimer();
203212

204213
// We then expect the counter to stop increasing
205214
await (new Promise(resolve => setTimeout(resolve, 1000)));
206215
const res4 = await actor.getCounter();
207-
expect(res4).toEqual(100);
216+
expect(res4).toEqual(200);
208217

209218
}, 10000);
210219
});

0 commit comments

Comments
 (0)