returnsThis
import { returnsThis } from "jsr:@ende/testing/mock";function
function returnsThis<Self = any, Args extends unknown[] = any[]>(): (this: Self, ...args: Args) => SelfCreates a function that returns the instance the method was called on.
Returns
A function that returns the instance the method was called on.
Example: Usage
import { returnsThis } from "@ende/testing/mock";
import { assertEquals } from "@ende/assert";
const func = returnsThis();
const obj = { func };
assertEquals(obj.func(), obj);