Skip to content

Commit

Permalink
Refactor and simplify execution unit tests to be slimmer
Browse files Browse the repository at this point in the history
  • Loading branch information
jpwilliams committed Sep 26, 2023
1 parent 899d4b0 commit bc5bb14
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 214 deletions.
13 changes: 8 additions & 5 deletions packages/inngest/src/components/InngestFunction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { jest } from "@jest/globals";
import { EventSchemas, InngestMiddleware, type EventPayload } from "@local";
import { InngestFunction } from "@local/components/InngestFunction";
import { STEP_INDEXING_SUFFIX } from "@local/components/InngestStepTools";
import { NonRetriableError } from "@local/components/NonRetriableError";
import {
_internals,
type ExecutionResult,
type ExecutionResults,
type InngestExecutionOptions,
} from "@local/components/InngestExecution";
import { InngestFunction } from "@local/components/InngestFunction";
import { STEP_INDEXING_SUFFIX } from "@local/components/InngestStepTools";
import { NonRetriableError } from "@local/components/NonRetriableError";
} from "@local/components/execution/InngestExecution";
import { _internals } from "@local/components/execution/v1";
import { ServerTiming } from "@local/helpers/ServerTiming";
import { internalEvents } from "@local/helpers/consts";
import {
Expand Down Expand Up @@ -146,6 +146,7 @@ describe("runFn", () => {

const execution = fn["createExecution"]({
data: { event: { name: "foo", data: { foo: "foo" } } },
runId: "run",
stepState: {},
stepCompletionOrder: [],
});
Expand Down Expand Up @@ -185,6 +186,7 @@ describe("runFn", () => {
const execution = fn["createExecution"]({
data: { event: { name: "foo", data: { foo: "foo" } } },
stepState: {},
runId: "run",
stepCompletionOrder: [],
});

Expand Down Expand Up @@ -216,6 +218,7 @@ describe("runFn", () => {
) => {
const execution = fn["createExecution"]({
data: { event: opts?.event || { name: "foo", data: {} } },
runId: "run",
stepState,
stepCompletionOrder: opts?.stackOrder ?? Object.keys(stepState),
isFailureHandler: Boolean(opts?.onFailure),
Expand Down
Loading

0 comments on commit bc5bb14

Please sign in to comment.