mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-26 19:13:02 +00:00
Refactor
This commit is contained in:
parent
80daf7c749
commit
88664486af
1 changed files with 7 additions and 8 deletions
15
test/api.ts
15
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 ? {
|
const auth = me ? {
|
||||||
i: me.account.token
|
i: me.token
|
||||||
} : {};
|
} : {};
|
||||||
|
|
||||||
assert.request(server)
|
const res = await assert.request(server)
|
||||||
.post(endpoint)
|
.post(endpoint)
|
||||||
.send(Object.assign(auth, params))
|
.send(Object.assign(auth, params));
|
||||||
.end((err, res) => {
|
|
||||||
ok(res);
|
return res;
|
||||||
});
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const signup = async (params?: any) => {
|
const signup = async (params?: any) => {
|
||||||
const q = Object.assign({
|
const q = Object.assign({
|
||||||
|
|
Loading…
Reference in a new issue