mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-28 14:58:09 +09:00
Use Promise
This commit is contained in:
parent
83def8cef5
commit
a52eb07fc8
13
test/api.ts
13
test/api.ts
@ -29,18 +29,17 @@ const async = fn => (done) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const request = (endpoint, params, me?) => new Promise<any>((ok, ng) => {
|
const request = async (endpoint, params, me?) => {
|
||||||
const auth = me ? {
|
const auth = me ? {
|
||||||
i: me.token
|
i: me.token
|
||||||
} : {};
|
} : {};
|
||||||
|
|
||||||
chai.request(server)
|
const res = await chai.request(server)
|
||||||
.post(endpoint)
|
.post(endpoint)
|
||||||
.send(Object.assign(auth, params))
|
.send(Object.assign(auth, params));
|
||||||
.end((err, res) => {
|
|
||||||
ok(res);
|
return res;
|
||||||
});
|
};
|
||||||
});
|
|
||||||
|
|
||||||
describe('API', () => {
|
describe('API', () => {
|
||||||
// Reset database each test
|
// Reset database each test
|
||||||
|
Loading…
Reference in New Issue
Block a user