generator.client.vue.test.unit.http.AxiosStub.ts.mustache Maven / Gradle / Ivy
import type { AxiosInstance, AxiosResponse } from 'axios';
import sinon, { type SinonStub } from 'sinon';
export interface AxiosStubInstance extends AxiosInstance {
get: SinonStub;
put: SinonStub;
post: SinonStub;
delete: SinonStub;
}
export const stubAxiosInstance = (): AxiosStubInstance =>
({
get: sinon.stub(),
put: sinon.stub(),
post: sinon.stub(),
delete: sinon.stub(),
}) as AxiosStubInstance;
export const dataAxiosResponse = (data: T): AxiosResponse =>
({
data,
}) as AxiosResponse;