mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
types: Add (passing) regression test for #5396
This commit is contained in:
28
test/integration/bun-types/fixture/5396.test.ts
Normal file
28
test/integration/bun-types/fixture/5396.test.ts
Normal 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");
|
||||
Reference in New Issue
Block a user