diff --git a/src/lib/Context.ts b/src/lib/Context.ts index 81fe7e83..836a4260 100644 --- a/src/lib/Context.ts +++ b/src/lib/Context.ts @@ -185,16 +185,7 @@ export class ProcessingResult { } export function newProcessingResult(): ProcessingResult { - return { - executedActions: [], - processedAttachmentConfigs: 0, - processedAttachments: 0, - processedMessageConfigs: 0, - processedMessages: 0, - processedThreadConfigs: 0, - processedThreads: 0, - status: ProcessingStatus.OK, - } + return new ProcessingResult() } export type Context = diff --git a/src/lib/e2e/E2E.spec.ts b/src/lib/e2e/E2E.spec.ts index 49113fc0..05ffa427 100644 --- a/src/lib/e2e/E2E.spec.ts +++ b/src/lib/e2e/E2E.spec.ts @@ -1,5 +1,6 @@ import { mock } from "jest-mock-extended" import { ExampleInfo } from "../../examples/Example" +import { ConfigMocks } from "../../test/mocks/ConfigMocks" import { MockFactory, Mocks } from "../../test/mocks/MockFactory" import { EnvContext, @@ -389,3 +390,40 @@ describe("runTests", () => { expect((result.error as Error)?.message).toContain("A forced exeption") }) }) + +describe("runTests with migrationConfig", () => { + let globals: E2EGlobalConfig + let mockTestConfig: E2ETestConfig + let migrationConfig + beforeAll(() => { + globals = newE2EGlobalConfig(ctx) + const info: ExampleInfo = { + name: "test-v1", + title: "Test v1 config", + description: "Test v1 config description", + category: "basics", + schemaVersion: "v1", + } + const initConfig: E2EInitConfig = { + mails: [{}], + } + migrationConfig = ConfigMocks.newDefaultV1ConfigJson() + const mockTests: E2ETest[] = [] + mockTestConfig = { + info, + globals, + initConfig, + migrationConfig, + tests: mockTests, + } as E2ETestConfig + }) + + beforeEach(() => { + jest.clearAllMocks() + }) + it("should process migrationConfig", () => { + E2E.runTests(mockTestConfig, true, undefined, RunMode.DANGEROUS, ctx) + + expect(ctx.env.mailApp.sendEmail).not.toHaveBeenCalled() + }) +})