This commit is contained in:
syuilo 2018-10-16 08:27:20 +09:00
parent 64087acfee
commit 8a51b89f0f

View file

@ -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({