types: Add (passing) regression test for #5396

This commit is contained in:
Alistair Smith
2025-10-07 16:32:42 -07:00
parent ed0d932a6d
commit de6ea7375a

View File

@@ -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<AnyDTO> {
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");