I actually managed to figure this out. Apparently my first try was almost correct:
vi.mock("@/composables/ApiClient", () => ({
useApiClient: () => ({
apiClient // from the previous codeblock
})
}));
But instead of using the apiClient const, I needed to actually write everything open.
vi.mock("@/composables/ApiClient", () => ({
useApiClient: () => ({
apiClient: {
getSafe: vi.fn(() => ({
response: {
data: {
someData: "something",
otherData: "somethingElse"
}
}
}))
}
})
}));
Doing it this way the mock started to work. It looks horrible and I wish I could use some variables to make this look nice, but I guess it can't be helped.