feat: setup test env

This commit is contained in:
crazywoola 2023-05-12 14:33:11 +08:00
parent c6cc1b43c7
commit c614daae54
4 changed files with 21 additions and 11 deletions

View File

@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-env"]
}

View File

@ -1,7 +1,6 @@
'use strict';
const axios = require('axios');
import axios from 'axios'
const BASE_URL = 'https://api.dify.ai/v1';
const BASE_URL = 'https://api.dify.ai/v1'
const routes = {
application: {

View File

@ -15,7 +15,14 @@
],
"license": "MIT",
"scripts": {
"test": "jest"
"test": "jest",
"test:coverage": "jest --coverage",
"test:watch": "jest --watchAll"
},
"jest": {
"transform": {
"^.+\\.[t|j]sx?$": "babel-jest"
}
},
"dependencies": {
"axios": "^1.3.5"

View File

@ -1,8 +1,8 @@
import { LangGeniusClient } from '../index';
import { LangGeniusClient } from "..";
describe('LangGeniusClient', () => {
it('should be defined', async () => {
const client = new LangGeniusClient('your-api-key');
describe('Client', () => {
test('should create a client', () => {
const client = new LangGeniusClient('test');
expect(client).toBeDefined();
});
})
});