UNPKG

deepai

Version:

[![npm version](https://img.shields.io/npm/v/deepai.svg?style=flat-square)](https://www.npmjs.org/package/deepai) [![CodeQL](https://github.com/deepai-org/deepai-js-client/actions/workflows/codeql.yml/badge.svg)](https://github.com/deepai-org/deepai-js-cl

24 lines (14 loc) 611 B
const DeepAI = require('../lib/core/DeepAI'); const mockAxios = require('jest-mock-axios').default; jest.mock('axios', () => mockAxios); import "regenerator-runtime/runtime"; const APIKEY = 'quickstart-QUdJIGlzIGNvbWluZy4uLi4K' it('should make a POST request and return data', async () => { const mockedDeepAI = new DeepAI(mockAxios); mockedDeepAI.setApiKey(APIKEY); const response = mockedDeepAI.callStandardApi('someModel', {someInput: 'testInput'}); mockAxios.mockResponse({ data: 'mocked data' }); await expect(response).resolves.toEqual('mocked data'); });