This commit is contained in:
syuilo 2017-01-17 11:37:14 +09:00
parent ea2a573492
commit bd86a7ad48
1 changed files with 35 additions and 6 deletions

View File

@ -46,12 +46,41 @@ describe('API', () => {
let me; let me;
it('create account', done => { describe('signup', () => {
request('/signup', account).then(res => { it('不正なユーザー名でアカウントが作成できない', done => {
res.should.have.status(200); request('/signup', {
res.body.should.be.a('object'); username: 'sakurako.',
res.body.should.have.property('username').eql(account.username); password: account.password
done(); }).then(res => {
res.should.have.status(400);
done();
});
});
it('空のパスワードでアカウントが作成できない', done => {
request('/signup', {
username: account.username,
password: ''
}).then(res => {
res.should.have.status(400);
done();
});
});
it('正しくアカウントが作成できる', done => {
request('/signup', account).then(res => {
res.should.have.status(200);
res.body.should.be.a('object');
res.body.should.have.property('username').eql(account.username);
done();
});
});
it('同じユーザー名のアカウントは作成できない', done => {
request('/signup', account).then(res => {
res.should.have.status(400);
done();
});
}); });
}); });