Rename methods parameter to props
This commit is contained in:
@@ -4,11 +4,11 @@ export type DeepPartial<T> = T extends object
|
||||
}
|
||||
: T;
|
||||
|
||||
export function mockedObject<T extends object>(methods: DeepPartial<T>): T {
|
||||
export function mockedObject<T extends object>(props: DeepPartial<T>): T {
|
||||
return new Proxy<T>({} as unknown as T, {
|
||||
get: (_target, prop) => {
|
||||
if (prop in methods) {
|
||||
return (methods as any)[prop];
|
||||
if (prop in props) {
|
||||
return (props as any)[prop];
|
||||
}
|
||||
throw new Error(`Method ${String(prop)} not mocked`);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user