From de6ea7375aec08ebb0eaf8b588dfe90444eec893 Mon Sep 17 00:00:00 2001 From: Alistair Smith Date: Tue, 7 Oct 2025 16:32:42 -0700 Subject: [PATCH] types: Add (passing) regression test for #5396 --- .../bun-types/fixture/5396.test.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/integration/bun-types/fixture/5396.test.ts diff --git a/test/integration/bun-types/fixture/5396.test.ts b/test/integration/bun-types/fixture/5396.test.ts new file mode 100644 index 0000000000..3f51baef0b --- /dev/null +++ b/test/integration/bun-types/fixture/5396.test.ts @@ -0,0 +1,28 @@ +import { describe, expect, it, jest, mock, spyOn } from "bun:test"; + +class AnyDTO { + anyField: string = "any_value"; +} + +class AnyClass { + async anyMethod(): Promise { + return new AnyDTO(); + } +} + +const anyObject: AnyClass = { + anyMethod: jest.fn(), +}; + +describe("Any describe", () => { + it("should return any value", async () => { + spyOn(anyObject, "anyMethod").mockResolvedValue({ anyField: "any_value" }); + const anyValue = await anyObject.anyMethod(); + + expect(anyValue).toEqual({ anyField: "any_value" }); + }); +}); + +const mockSomething = mock((): string => "hi"); +mockSomething.mockImplementation(() => "hello"); +mockSomething.mockReturnValue("hello");