You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of having to modify mock implementations manually, it might be nice to allow an argument as the first argument in mock<...>({ ... }) which defines mock implementations/values for the instance:
interface ResourcesApi {
get(id: string): Promise<any>
}
interface Api {
resources: ResourcesApi
}
const api = mock<Api>({
resources: {
get: true // equivalent to api.resources.get.mockReturnValue(true)
// or get: () => true which is equivalent to api.resources.get.mockImplementation(() => true)
}
})
// instead of ...
//
Looks good. I now have this working. I have used DeepPartial so that you can provide incomplete implementations for the top level type and lower levels. Will create a PR shortly.
Instead of having to modify mock implementations manually, it might be nice to allow an argument as the first argument in
mock<...>({ ... })
which defines mock implementations/values for the instance:Refer to #3 for the nested support.
Thoughts?
The text was updated successfully, but these errors were encountered: