forked from FoundKeyGang/FoundKey
test
This commit is contained in:
parent
adb42fe60b
commit
6d3542465d
1 changed files with 30 additions and 18 deletions
48
test/api.js
48
test/api.js
|
@ -124,26 +124,38 @@ describe('API', () => {
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('i/update', () => new Promise(async (done) => {
|
describe('i/update', () => {
|
||||||
const me = await insertSakurako();
|
it('アカウント設定を更新できる', () => new Promise(async (done) => {
|
||||||
|
const me = await insertSakurako();
|
||||||
|
|
||||||
const myName = '大室櫻子';
|
const myName = '大室櫻子';
|
||||||
const myLocation = '七森中';
|
const myLocation = '七森中';
|
||||||
const myBirthday = '2000-09-07';
|
const myBirthday = '2000-09-07';
|
||||||
|
|
||||||
request('/i/update', {
|
request('/i/update', {
|
||||||
name: myName,
|
name: myName,
|
||||||
location: myLocation,
|
location: myLocation,
|
||||||
birthday: myBirthday
|
birthday: myBirthday
|
||||||
}, me).then(res => {
|
}, me).then(res => {
|
||||||
res.should.have.status(200);
|
res.should.have.status(200);
|
||||||
res.body.should.be.a('object');
|
res.body.should.be.a('object');
|
||||||
res.body.should.have.property('name').eql(myName);
|
res.body.should.have.property('name').eql(myName);
|
||||||
res.body.should.have.property('location').eql(myLocation);
|
res.body.should.have.property('location').eql(myLocation);
|
||||||
res.body.should.have.property('birthday').eql(myBirthday);
|
res.body.should.have.property('birthday').eql(myBirthday);
|
||||||
done();
|
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', () => {
|
describe('users/show', () => {
|
||||||
it('ユーザーが取得できる', () => new Promise(async (done) => {
|
it('ユーザーが取得できる', () => new Promise(async (done) => {
|
||||||
|
|
Loading…
Reference in a new issue