Skip to content

Commit a013a69

Browse files
committed
Fixed e2e tests for actor ttl
Signed-off-by: Amulya Varote <[email protected]>
1 parent e6c86f8 commit a013a69

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

test/actor/DemoActorReminderImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default class DemoActorReminderImpl extends AbstractActor implements Demo
1919

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

test/e2e/actors.http.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,21 @@ describe('http/actors', () => {
190190
expect(res0).toEqual(0);
191191

192192
// Now we wait for dueTime (2s)
193-
await (new Promise(resolve => setTimeout(resolve, 1000)));
193+
await (new Promise(resolve => setTimeout(resolve, 2000)));
194194

195195
// After that the timer callback will be called
196196
// In our case, the callback increments the count attribute
197197
// the count attribute is +100 due to the passed state
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
201+
// Stop the timer
202+
await actor.removeTimer();
203+
204+
// We then expect the counter to stop increasing
203205
await (new Promise(resolve => setTimeout(resolve, 1000)));
204-
const res2 = await actor.getCounter();
205-
expect(res2).toEqual(200);
206+
const res4 = await actor.getCounter();
207+
expect(res4).toEqual(100);
206208

207209
}, 10000);
208210
});

0 commit comments

Comments
 (0)