Skip to content

Commit

Permalink
Merge branch 'main' into experimental/hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jpwilliams committed Dec 11, 2024
2 parents cf2da79 + 325ef79 commit 0d73a20
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 60 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-kiwis-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@inngest/test": patch
---

Fix `@inngest/test` automatic spying not accounting for `step.**`
2 changes: 1 addition & 1 deletion packages/middleware-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"@inngest/test": "0.1.3-pr-777.0",
"@inngest/test": "^0.1.3",
"@types/eslint__js": "^8.42.3",
"@types/jest": "^29.5.14",
"eslint": "^8.30.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/test/src/spy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,9 @@ export function fn<T extends Procedure = Procedure>(
return enhancedSpy as any;
}

export const mockAny = (obj: unknown) => {
export const mockAny = <T>(obj: T): T => {
if (typeof obj === "function") {
return fn(obj as (...args: any[]) => any);
return fn(obj as (...args: any[]) => any) as T;
}

if (typeof obj === "object" && obj !== null) {
Expand Down
4 changes: 1 addition & 3 deletions packages/test/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import { mockAny } from "./spy.js";
* this functionality.
*/
export const mockCtx = (ctx: Readonly<Context.Any>): Context.Any => {
const step = mockAny(ctx.step) as Context.Any["step"];

return {
...ctx,
step,
step: mockAny(ctx.step),
};
};

Expand Down
61 changes: 7 additions & 54 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0d73a20

Please sign in to comment.