From 6d3542465de9fc73259c67f238691e03adff52bc Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 19 Jan 2017 15:40:43 +0900 Subject: [PATCH] test --- test/api.js | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/test/api.js b/test/api.js index 81903d2973..052f929437 100644 --- a/test/api.js +++ b/test/api.js @@ -124,26 +124,38 @@ describe('API', () => { })); }); - it('i/update', () => new Promise(async (done) => { - const me = await insertSakurako(); + describe('i/update', () => { + it('アカウント設定を更新できる', () => new Promise(async (done) => { + const me = await insertSakurako(); - const myName = '大室櫻子'; - const myLocation = '七森中'; - const myBirthday = '2000-09-07'; + const myName = '大室櫻子'; + const myLocation = '七森中'; + const myBirthday = '2000-09-07'; - request('/i/update', { - name: myName, - location: myLocation, - birthday: myBirthday - }, me).then(res => { - res.should.have.status(200); - res.body.should.be.a('object'); - res.body.should.have.property('name').eql(myName); - res.body.should.have.property('location').eql(myLocation); - res.body.should.have.property('birthday').eql(myBirthday); - done(); - }); - })); + request('/i/update', { + name: myName, + location: myLocation, + birthday: myBirthday + }, me).then(res => { + res.should.have.status(200); + res.body.should.be.a('object'); + res.body.should.have.property('name').eql(myName); + res.body.should.have.property('location').eql(myLocation); + res.body.should.have.property('birthday').eql(myBirthday); + done(); + }); + })); + + it('不正な誕生日の形式で怒られる', () => new Promise(async (done) => { + const me = await insertSakurako(); + request('/i/update', { + birthday: '2000/09/07' + }, me).then(res => { + res.should.have.status(400); + done(); + }); + })); + }); describe('users/show', () => { it('ユーザーが取得できる', () => new Promise(async (done) => {