mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 17:33:22 +02:00
[Test:API] Add clear birthday test
This commit is contained in:
parent
4f9493265a
commit
2110cbc942
1 changed files with 20 additions and 6 deletions
26
test/api.js
26
test/api.js
|
@ -148,6 +148,20 @@ describe('API', () => {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('誕生日の設定を削除できる', () => new Promise(async (done) => {
|
||||||
|
const me = await insertSakurako({
|
||||||
|
birthday: '2000-09-07'
|
||||||
|
});
|
||||||
|
request('/i/update', {
|
||||||
|
birthday: ''
|
||||||
|
}, me).then(res => {
|
||||||
|
res.should.have.status(200);
|
||||||
|
res.body.should.be.a('object');
|
||||||
|
res.body.should.have.property('birthday').eql(null);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
it('不正な誕生日の形式で怒られる', () => new Promise(async (done) => {
|
it('不正な誕生日の形式で怒られる', () => new Promise(async (done) => {
|
||||||
const me = await insertSakurako();
|
const me = await insertSakurako();
|
||||||
request('/i/update', {
|
request('/i/update', {
|
||||||
|
@ -695,20 +709,20 @@ describe('API', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function insertSakurako() {
|
async function insertSakurako(opts) {
|
||||||
return await db.get('users').insert({
|
return await db.get('users').insert(Object.assign({
|
||||||
token: '!00000000000000000000000000000000',
|
token: '!00000000000000000000000000000000',
|
||||||
username: 'sakurako',
|
username: 'sakurako',
|
||||||
username_lower: 'sakurako',
|
username_lower: 'sakurako',
|
||||||
password: '$2a$08$FnHXg3tP.M/kINWgQSXNqeoBsiVrkj.ecXX8mW9rfBzMRkibYfjYy' // HimawariDaisuki06160907
|
password: '$2a$08$FnHXg3tP.M/kINWgQSXNqeoBsiVrkj.ecXX8mW9rfBzMRkibYfjYy' // HimawariDaisuki06160907
|
||||||
});
|
}, opts));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function insertHimawari() {
|
async function insertHimawari(opts) {
|
||||||
return await db.get('users').insert({
|
return await db.get('users').insert(Object.assign({
|
||||||
token: '!00000000000000000000000000000001',
|
token: '!00000000000000000000000000000001',
|
||||||
username: 'himawari',
|
username: 'himawari',
|
||||||
username_lower: 'himawari',
|
username_lower: 'himawari',
|
||||||
password: '$2a$08$OPESxR2RE/ZijjGanNKk6ezSqGFitqsbZqTjWUZPLhORMKxHCbc4O' // ilovesakurako
|
password: '$2a$08$OPESxR2RE/ZijjGanNKk6ezSqGFitqsbZqTjWUZPLhORMKxHCbc4O' // ilovesakurako
|
||||||
});
|
}, opts));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue