All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.client.vue.test.unit.http.AxiosStub.ts.mustache Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
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;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy