Add nyaize syntax

This commit is contained in:
Acid Chicken (硫酸鶏) 2019-01-24 19:07:49 +09:00
parent 225544e985
commit 2bac1a90f0
No known key found for this signature in database
GPG key ID: 5388F56C75B677A1
3 changed files with 102 additions and 17 deletions

View file

@ -369,6 +369,52 @@ describe('API', () => {
expect(res).have.status(400);
}));
it('can make nyanize enable', async(async () => {
const me = await signup();
const post = {
text: 'なん<nya>なん<!nya>なん</!nya>なん</nya>なん'
};
const res = await request('/notes/create', post, me);
expect(res).have.status(200);
expect(res.body).be.a('object');
expect(res.body).have.property('createdNote');
expect(res.body.createdNote).have.property('text').eql('なんにゃんなんにゃんなん');
}));
it('can make nyanize disable', async(async () => {
const me = await signup();
await request('/i/update', {
isCat: true
}, me);
const post = {
text: 'なん<!nya>なん<nya>なん</nya>なん</!nya>なん'
};
const res = await request('/notes/create', post, me);
expect(res).have.status(200);
expect(res.body).be.a('object');
expect(res.body).have.property('createdNote');
expect(res.body.createdNote).have.property('text').eql('にゃんなんにゃんなんにゃん');
}));
it('throw error when invalid syntax', async(async () => {
const me = await signup();
const post = {
text: 'なん<nya>なん'
};
const res = await request('/notes/create', post, me);
expect(res).have.status(400);
}));
it('存在しないリプライ先で怒られる', async(async () => {
const me = await signup();
const post = {