diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-16 08:27:20 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-16 08:27:20 +0900 |
| commit | 88664486afbdfb89a45b6de90491b4426dccbd6c (patch) | |
| tree | 8002289bb1b471c18c9cc3cf4a2f6c10e624d0fa /test/api.ts | |
| parent | Implement API tests (diff) | |
| download | sharkey-88664486afbdfb89a45b6de90491b4426dccbd6c.tar.gz sharkey-88664486afbdfb89a45b6de90491b4426dccbd6c.tar.bz2 sharkey-88664486afbdfb89a45b6de90491b4426dccbd6c.zip | |
Refactor
Diffstat (limited to 'test/api.ts')
| -rw-r--r-- | test/api.ts | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/test/api.ts b/test/api.ts index ee90da5617..cc7c8c5293 100644 --- a/test/api.ts +++ b/test/api.ts @@ -32,18 +32,17 @@ const async = (fn: Function) => (done: Function) => { }); }; -const request = (endpoint: string, params: any, me?: any): Promise<ChaiHttp.Response> => new Promise((ok, ng) => { +const request = async (endpoint: string, params: any, me?: any): Promise<ChaiHttp.Response> => { const auth = me ? { - i: me.account.token + i: me.token } : {}; - assert.request(server) + const res = await assert.request(server) .post(endpoint) - .send(Object.assign(auth, params)) - .end((err, res) => { - ok(res); - }); -}); + .send(Object.assign(auth, params)); + + return res; +}; const signup = async (params?: any) => { const q = Object.assign({ |