feat: 添加query功能
This commit is contained in:
12
test/adapter.ts
Normal file
12
test/adapter.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { adapter } from '../src/adapter';
|
||||
const hostname = 'localhost:3002';
|
||||
|
||||
describe('Adapter', () => {
|
||||
// 编写一个测试用例
|
||||
// yarn test --testNamePattern='Adapter'
|
||||
test('Adapter:First', () => {
|
||||
adapter({ url: hostname + '/api/router' }).then((res) => {
|
||||
expect(res).toEqual({ id: 1 });
|
||||
});
|
||||
});
|
||||
});
|
||||
7
test/hello.test.ts
Normal file
7
test/hello.test.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
describe('Hello', () => {
|
||||
// 编写一个测试用例
|
||||
// yarn test --testNamePattern='Hello'
|
||||
test('Hello World', () => {
|
||||
console.log('Hello World');
|
||||
});
|
||||
});
|
||||
17
test/node-adapter.ts
Normal file
17
test/node-adapter.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { nodeAdapter } from "../src/node-adapter";
|
||||
|
||||
// tsx test/node-adapter.ts
|
||||
const main = async () => {
|
||||
const res = await nodeAdapter({
|
||||
url: 'http://127.0.0.1/api/router',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: {
|
||||
path: 'demo',
|
||||
key: '1',
|
||||
},
|
||||
});
|
||||
console.log(res);
|
||||
};
|
||||
main();
|
||||
@@ -2,8 +2,24 @@ import { Query } from './../src/index';
|
||||
|
||||
const query = new Query({ url: '/api/router' });
|
||||
|
||||
describe('Query', () => {
|
||||
// 编写一个测试用例
|
||||
// yarn test --testNamePattern='Query'
|
||||
test('Query:First', async () => {
|
||||
console.log('Query');
|
||||
});
|
||||
});
|
||||
|
||||
// test('query', async () => {
|
||||
// query.get({ id: 1 }).then((res) => {
|
||||
// expect(res).toEqual({ id: 1 });
|
||||
// });
|
||||
// }
|
||||
|
||||
// describe('Hello', () => {
|
||||
// // 编写一个测试用例
|
||||
// // yarn test --testNamePattern='Hello'
|
||||
// test('Hello World', () => {
|
||||
// console.log('Hello World');
|
||||
// });
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user