diff --git a/packages/dbos-dbtriggers/tests/dbtriggers_seq.test.ts b/packages/dbos-dbtriggers/tests/dbtriggers_seq.test.ts index a67323f0..d53cac90 100644 --- a/packages/dbos-dbtriggers/tests/dbtriggers_seq.test.ts +++ b/packages/dbos-dbtriggers/tests/dbtriggers_seq.test.ts @@ -17,11 +17,6 @@ const testTableName = "dbos_test_trig_seq"; type KnexTransactionContext = TransactionContext; -interface TestingRuntimeImpl { - destroyEventReceivers() : Promise; - initEventReceivers(): Promise; -} - class DBOSTestNoClass { } @@ -140,7 +135,7 @@ describe("test-db-triggers", () => { expect(DBOSTriggerTestClassSN.tsRecordMap.get(2)?.status).toBe("Ordered"); // Take down - await (testRuntime as unknown as TestingRuntimeImpl).destroyEventReceivers(); + //await testRuntime.deactivateEventReceivers(); // Do more stuff // Invalid record, won't show up because it is well out of sequence @@ -155,7 +150,7 @@ describe("test-db-triggers", () => { console.log("************************************************** Restart *****************************************************"); DBOSTriggerTestClassSN.reset(); - await (testRuntime as unknown as TestingRuntimeImpl).initEventReceivers(); + //await testRuntime.initEventReceivers(); console.log("************************************************** Restarted *****************************************************"); DBOSTriggerTestClassSN.reset(); diff --git a/src/testing/testing_runtime.ts b/src/testing/testing_runtime.ts index 651409da..3a9b806e 100644 --- a/src/testing/testing_runtime.ts +++ b/src/testing/testing_runtime.ts @@ -78,6 +78,7 @@ export interface TestingRuntime { destroy(): Promise; // Release resources after tests. deactivateEventReceivers(): Promise; // Deactivate event receivers. + initEventReceivers(): Promise; // Init / reactivate event receivers. } /** @@ -113,9 +114,6 @@ export class TestingRuntimeImpl implements TestingRuntime { await this.#dbosExec.init(userClasses); this.#server = new DBOSHttpServer(this.#dbosExec); await this.initEventReceivers(); - this.#scheduler = new DBOSScheduler(this.#dbosExec); - this.#scheduler.initScheduler(); - this.#wfQueueRunner = wfQueueRunner.dispatchLoop(this.#dbosExec); this.#applicationConfig = this.#dbosExec.config.application ?? {}; this.#isInitialized = true; } @@ -124,6 +122,9 @@ export class TestingRuntimeImpl implements TestingRuntime { for (const evtRcvr of this.#dbosExec!.eventReceivers) { await evtRcvr.initialize(this.#dbosExec!); } + this.#scheduler = new DBOSScheduler(this.#dbosExec!); + this.#scheduler.initScheduler(); + this.#wfQueueRunner = wfQueueRunner.dispatchLoop(this.#dbosExec!); } /**