@ofm/ajax
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

ajax

import { initAjax, ajax } from '../src/index';
import mock from '../src/mock';

describe('test ajax', () => {
    test('initAjax', async () => {
        const baseURL = 'https://some-domain.com/api';
        initAjax({
            baseURL,
        });
        mock.onGet('/login').reply(200, { isSuccess: true });
        const response = await ajax.get('/login');
        expect(response.config.baseURL).toBe(baseURL);
        expect(response.data).toEqual({ isSuccess: true });
    });
});

Readme

Keywords

Package Sidebar

Install

npm i @ofm/ajax

Weekly Downloads

1

Version

1.1.3

License

MIT

Unpacked Size

7.41 kB

Total Files

7

Last publish

Collaborators

  • boborua
  • void327
  • yuecjnadt