-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from GuoXiCheng/main
publish 1.0.22
- Loading branch information
Showing
8 changed files
with
108 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// import { createRequest } from '../request-lib'; | ||
|
||
// const wx = { | ||
// request: jest.fn() | ||
// }; | ||
|
||
// const request = createRequest({ | ||
// httpLib: 'wx', | ||
// httpClient: wx, | ||
// platform: 'gitee', | ||
// owner: 'test-owner', | ||
// repo: 'test-repo', | ||
// accessToken: 'test-token' | ||
// }); | ||
|
||
// describe('Test Wx Request', () => { | ||
// test('wx get success', async () => { | ||
// wx.request.mockImplementation(({ success }) => { | ||
// success({data: 'success'}); | ||
// }); | ||
// const result = await request.get('test-url', { order: 'desc'}); | ||
// expect(result).toEqual('success'); | ||
// expect(wx.request).toHaveBeenCalledWith({ | ||
// 'fail': expect.any(Function), | ||
// 'data': { | ||
// 'order': 'desc' | ||
// }, | ||
// 'header': { | ||
// 'Authorization': 'Bearer test-token' | ||
// }, | ||
// 'method': 'GET', | ||
// 'success': expect.any(Function), | ||
// 'url': 'test-url' | ||
// }); | ||
// }); | ||
|
||
// test('wx get fail', async () => { | ||
// wx.request.mockImplementation(({ fail }) => { | ||
// fail('fail'); | ||
// }); | ||
// try { | ||
// await request.get('test-url'); | ||
// } catch (error) { | ||
// expect(error).toEqual('fail'); | ||
// } | ||
// }); | ||
|
||
// test('wx post success', async () => { | ||
// wx.request.mockImplementation(({ success }) => { | ||
// success({data: 'success'}); | ||
// }); | ||
// const result = await request.post('test-url', 'test-body'); | ||
// expect(result).toEqual('success'); | ||
// expect(wx.request).toHaveBeenCalledWith({ | ||
// 'fail': expect.any(Function), | ||
// 'data': { | ||
// 'body': 'test-body' | ||
// }, | ||
// 'header': { | ||
// 'Authorization': 'Bearer test-token' | ||
// }, | ||
// 'method': 'POST', | ||
// 'success': expect.any(Function), | ||
// 'url': 'test-url' | ||
// }); | ||
// }); | ||
|
||
// test('wx patch success', async () => { | ||
// wx.request.mockImplementation(({ success }) => { | ||
// success({data: 'success'}); | ||
// }); | ||
// const result = await request.patch('test-url', 'test-body'); | ||
// expect(result).toEqual('success'); | ||
// expect(wx.request).toHaveBeenCalledWith({ | ||
// 'fail': expect.any(Function), | ||
// 'data': { | ||
// 'body': 'test-body' | ||
// }, | ||
// 'header': { | ||
// 'Authorization': 'Bearer test-token', | ||
// 'X-HTTP-Method-Override': 'PATCH' | ||
// }, | ||
// 'method': 'POST', | ||
// 'success': expect.any(Function), | ||
// 'url': 'test-url' | ||
// }); | ||
// }); | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
import { WxInstance } from "./wx-interface"; | ||
|
||
export type WxOptions = { | ||
httpLib: 'wx'; | ||
httpClient: WxInstance | ||
httpClient: WechatMiniprogram.Wx | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters