summaryrefslogtreecommitdiff
path: root/test/api.ts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-10-16 08:58:45 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-10-16 08:58:45 +0900
commita6844ebc9d5713b685da1b6265711a426a191183 (patch)
tree72a0659703a71559e87688662bb40358646cda45 /test/api.ts
parentAdd some tests and some fixes (diff)
downloadsharkey-a6844ebc9d5713b685da1b6265711a426a191183.tar.gz
sharkey-a6844ebc9d5713b685da1b6265711a426a191183.tar.bz2
sharkey-a6844ebc9d5713b685da1b6265711a426a191183.zip
Add some tests
Diffstat (limited to 'test/api.ts')
-rw-r--r--test/api.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/api.ts b/test/api.ts
index 1d6298669a..a978394129 100644
--- a/test/api.ts
+++ b/test/api.ts
@@ -200,4 +200,30 @@ describe('API', () => {
expect(res).have.status(400);
}));
});
+
+ describe('users/show', () => {
+ it('ユーザーが取得できる', async(async () => {
+ const me = await signup();
+ const res = await request('/users/show', {
+ userId: me.id
+ }, me);
+ expect(res).have.status(200);
+ expect(res.body).be.a('object');
+ expect(res.body).have.property('id').eql(me.id);
+ }));
+
+ it('ユーザーが存在しなかったら怒る', async(async () => {
+ const res = await request('/users/show', {
+ userId: '000000000000000000000000'
+ });
+ expect(res).have.status(400);
+ }));
+
+ it('間違ったIDで怒られる', async(async () => {
+ const res = await request('/users/show', {
+ userId: 'kyoppie'
+ });
+ expect(res).have.status(400);
+ }));
+ });
});