refactor: use test
This commit is contained in:
parent
07f885fea8
commit
ed3e035ad6
|
@ -100,90 +100,90 @@ describe('API visibility', () => {
|
||||||
|
|
||||||
//#region show post
|
//#region show post
|
||||||
// public
|
// public
|
||||||
it('[show] public-postを自分が見れる', async () => {
|
test('[show] public-postを自分が見れる', async () => {
|
||||||
const res = await show(pub.id, alice);
|
const res = await show(pub.id, alice);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-postをフォロワーが見れる', async () => {
|
test('[show] public-postをフォロワーが見れる', async () => {
|
||||||
const res = await show(pub.id, follower);
|
const res = await show(pub.id, follower);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-postを非フォロワーが見れる', async () => {
|
test('[show] public-postを非フォロワーが見れる', async () => {
|
||||||
const res = await show(pub.id, other);
|
const res = await show(pub.id, other);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-postを未認証が見れる', async () => {
|
test('[show] public-postを未認証が見れる', async () => {
|
||||||
const res = await show(pub.id, null);
|
const res = await show(pub.id, null);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
// home
|
// home
|
||||||
it('[show] home-postを自分が見れる', async () => {
|
test('[show] home-postを自分が見れる', async () => {
|
||||||
const res = await show(home.id, alice);
|
const res = await show(home.id, alice);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-postをフォロワーが見れる', async () => {
|
test('[show] home-postをフォロワーが見れる', async () => {
|
||||||
const res = await show(home.id, follower);
|
const res = await show(home.id, follower);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-postを非フォロワーが見れる', async () => {
|
test('[show] home-postを非フォロワーが見れる', async () => {
|
||||||
const res = await show(home.id, other);
|
const res = await show(home.id, other);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-postを未認証が見れる', async () => {
|
test('[show] home-postを未認証が見れる', async () => {
|
||||||
const res = await show(home.id, null);
|
const res = await show(home.id, null);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
// followers
|
// followers
|
||||||
it('[show] followers-postを自分が見れる', async () => {
|
test('[show] followers-postを自分が見れる', async () => {
|
||||||
const res = await show(fol.id, alice);
|
const res = await show(fol.id, alice);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-postをフォロワーが見れる', async () => {
|
test('[show] followers-postをフォロワーが見れる', async () => {
|
||||||
const res = await show(fol.id, follower);
|
const res = await show(fol.id, follower);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-postを非フォロワーが見れない', async () => {
|
test('[show] followers-postを非フォロワーが見れない', async () => {
|
||||||
const res = await show(fol.id, other);
|
const res = await show(fol.id, other);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-postを未認証が見れない', async () => {
|
test('[show] followers-postを未認証が見れない', async () => {
|
||||||
const res = await show(fol.id, null);
|
const res = await show(fol.id, null);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// specified
|
// specified
|
||||||
it('[show] specified-postを自分が見れる', async () => {
|
test('[show] specified-postを自分が見れる', async () => {
|
||||||
const res = await show(spe.id, alice);
|
const res = await show(spe.id, alice);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-postを指定ユーザーが見れる', async () => {
|
test('[show] specified-postを指定ユーザーが見れる', async () => {
|
||||||
const res = await show(spe.id, target);
|
const res = await show(spe.id, target);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-postをフォロワーが見れない', async () => {
|
test('[show] specified-postをフォロワーが見れない', async () => {
|
||||||
const res = await show(spe.id, follower);
|
const res = await show(spe.id, follower);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-postを非フォロワーが見れない', async () => {
|
test('[show] specified-postを非フォロワーが見れない', async () => {
|
||||||
const res = await show(spe.id, other);
|
const res = await show(spe.id, other);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-postを未認証が見れない', async () => {
|
test('[show] specified-postを未認証が見れない', async () => {
|
||||||
const res = await show(spe.id, null);
|
const res = await show(spe.id, null);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
@ -191,110 +191,110 @@ describe('API visibility', () => {
|
||||||
|
|
||||||
//#region show reply
|
//#region show reply
|
||||||
// public
|
// public
|
||||||
it('[show] public-replyを自分が見れる', async () => {
|
test('[show] public-replyを自分が見れる', async () => {
|
||||||
const res = await show(pubR.id, alice);
|
const res = await show(pubR.id, alice);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-replyをされた人が見れる', async () => {
|
test('[show] public-replyをされた人が見れる', async () => {
|
||||||
const res = await show(pubR.id, target);
|
const res = await show(pubR.id, target);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-replyをフォロワーが見れる', async () => {
|
test('[show] public-replyをフォロワーが見れる', async () => {
|
||||||
const res = await show(pubR.id, follower);
|
const res = await show(pubR.id, follower);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-replyを非フォロワーが見れる', async () => {
|
test('[show] public-replyを非フォロワーが見れる', async () => {
|
||||||
const res = await show(pubR.id, other);
|
const res = await show(pubR.id, other);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-replyを未認証が見れる', async () => {
|
test('[show] public-replyを未認証が見れる', async () => {
|
||||||
const res = await show(pubR.id, null);
|
const res = await show(pubR.id, null);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
// home
|
// home
|
||||||
it('[show] home-replyを自分が見れる', async () => {
|
test('[show] home-replyを自分が見れる', async () => {
|
||||||
const res = await show(homeR.id, alice);
|
const res = await show(homeR.id, alice);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-replyをされた人が見れる', async () => {
|
test('[show] home-replyをされた人が見れる', async () => {
|
||||||
const res = await show(homeR.id, target);
|
const res = await show(homeR.id, target);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-replyをフォロワーが見れる', async () => {
|
test('[show] home-replyをフォロワーが見れる', async () => {
|
||||||
const res = await show(homeR.id, follower);
|
const res = await show(homeR.id, follower);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-replyを非フォロワーが見れる', async () => {
|
test('[show] home-replyを非フォロワーが見れる', async () => {
|
||||||
const res = await show(homeR.id, other);
|
const res = await show(homeR.id, other);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-replyを未認証が見れる', async () => {
|
test('[show] home-replyを未認証が見れる', async () => {
|
||||||
const res = await show(homeR.id, null);
|
const res = await show(homeR.id, null);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
// followers
|
// followers
|
||||||
it('[show] followers-replyを自分が見れる', async () => {
|
test('[show] followers-replyを自分が見れる', async () => {
|
||||||
const res = await show(folR.id, alice);
|
const res = await show(folR.id, alice);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-replyを非フォロワーでもリプライされていれば見れる', async () => {
|
test('[show] followers-replyを非フォロワーでもリプライされていれば見れる', async () => {
|
||||||
const res = await show(folR.id, target);
|
const res = await show(folR.id, target);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-replyをフォロワーが見れる', async () => {
|
test('[show] followers-replyをフォロワーが見れる', async () => {
|
||||||
const res = await show(folR.id, follower);
|
const res = await show(folR.id, follower);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-replyを非フォロワーが見れない', async () => {
|
test('[show] followers-replyを非フォロワーが見れない', async () => {
|
||||||
const res = await show(folR.id, other);
|
const res = await show(folR.id, other);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-replyを未認証が見れない', async () => {
|
test('[show] followers-replyを未認証が見れない', async () => {
|
||||||
const res = await show(folR.id, null);
|
const res = await show(folR.id, null);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// specified
|
// specified
|
||||||
it('[show] specified-replyを自分が見れる', async () => {
|
test('[show] specified-replyを自分が見れる', async () => {
|
||||||
const res = await show(speR.id, alice);
|
const res = await show(speR.id, alice);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-replyを指定ユーザーが見れる', async () => {
|
test('[show] specified-replyを指定ユーザーが見れる', async () => {
|
||||||
const res = await show(speR.id, target);
|
const res = await show(speR.id, target);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-replyをされた人が指定されてなくても見れる', async () => {
|
test('[show] specified-replyをされた人が指定されてなくても見れる', async () => {
|
||||||
const res = await show(speR.id, target);
|
const res = await show(speR.id, target);
|
||||||
assert.strictEqual(res.body.text, 'x');
|
assert.strictEqual(res.body.text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-replyをフォロワーが見れない', async () => {
|
test('[show] specified-replyをフォロワーが見れない', async () => {
|
||||||
const res = await show(speR.id, follower);
|
const res = await show(speR.id, follower);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-replyを非フォロワーが見れない', async () => {
|
test('[show] specified-replyを非フォロワーが見れない', async () => {
|
||||||
const res = await show(speR.id, other);
|
const res = await show(speR.id, other);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-replyを未認証が見れない', async () => {
|
test('[show] specified-replyを未認証が見れない', async () => {
|
||||||
const res = await show(speR.id, null);
|
const res = await show(speR.id, null);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
@ -302,131 +302,131 @@ describe('API visibility', () => {
|
||||||
|
|
||||||
//#region show mention
|
//#region show mention
|
||||||
// public
|
// public
|
||||||
it('[show] public-mentionを自分が見れる', async () => {
|
test('[show] public-mentionを自分が見れる', async () => {
|
||||||
const res = await show(pubM.id, alice);
|
const res = await show(pubM.id, alice);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-mentionをされた人が見れる', async () => {
|
test('[show] public-mentionをされた人が見れる', async () => {
|
||||||
const res = await show(pubM.id, target);
|
const res = await show(pubM.id, target);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-mentionをフォロワーが見れる', async () => {
|
test('[show] public-mentionをフォロワーが見れる', async () => {
|
||||||
const res = await show(pubM.id, follower);
|
const res = await show(pubM.id, follower);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-mentionを非フォロワーが見れる', async () => {
|
test('[show] public-mentionを非フォロワーが見れる', async () => {
|
||||||
const res = await show(pubM.id, other);
|
const res = await show(pubM.id, other);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] public-mentionを未認証が見れる', async () => {
|
test('[show] public-mentionを未認証が見れる', async () => {
|
||||||
const res = await show(pubM.id, null);
|
const res = await show(pubM.id, null);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
// home
|
// home
|
||||||
it('[show] home-mentionを自分が見れる', async () => {
|
test('[show] home-mentionを自分が見れる', async () => {
|
||||||
const res = await show(homeM.id, alice);
|
const res = await show(homeM.id, alice);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-mentionをされた人が見れる', async () => {
|
test('[show] home-mentionをされた人が見れる', async () => {
|
||||||
const res = await show(homeM.id, target);
|
const res = await show(homeM.id, target);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-mentionをフォロワーが見れる', async () => {
|
test('[show] home-mentionをフォロワーが見れる', async () => {
|
||||||
const res = await show(homeM.id, follower);
|
const res = await show(homeM.id, follower);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-mentionを非フォロワーが見れる', async () => {
|
test('[show] home-mentionを非フォロワーが見れる', async () => {
|
||||||
const res = await show(homeM.id, other);
|
const res = await show(homeM.id, other);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] home-mentionを未認証が見れる', async () => {
|
test('[show] home-mentionを未認証が見れる', async () => {
|
||||||
const res = await show(homeM.id, null);
|
const res = await show(homeM.id, null);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
// followers
|
// followers
|
||||||
it('[show] followers-mentionを自分が見れる', async () => {
|
test('[show] followers-mentionを自分が見れる', async () => {
|
||||||
const res = await show(folM.id, alice);
|
const res = await show(folM.id, alice);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-mentionをメンションされていれば非フォロワーでも見れる', async () => {
|
test('[show] followers-mentionをメンションされていれば非フォロワーでも見れる', async () => {
|
||||||
const res = await show(folM.id, target);
|
const res = await show(folM.id, target);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-mentionをフォロワーが見れる', async () => {
|
test('[show] followers-mentionをフォロワーが見れる', async () => {
|
||||||
const res = await show(folM.id, follower);
|
const res = await show(folM.id, follower);
|
||||||
assert.strictEqual(res.body.text, '@target x');
|
assert.strictEqual(res.body.text, '@target x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-mentionを非フォロワーが見れない', async () => {
|
test('[show] followers-mentionを非フォロワーが見れない', async () => {
|
||||||
const res = await show(folM.id, other);
|
const res = await show(folM.id, other);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] followers-mentionを未認証が見れない', async () => {
|
test('[show] followers-mentionを未認証が見れない', async () => {
|
||||||
const res = await show(folM.id, null);
|
const res = await show(folM.id, null);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// specified
|
// specified
|
||||||
it('[show] specified-mentionを自分が見れる', async () => {
|
test('[show] specified-mentionを自分が見れる', async () => {
|
||||||
const res = await show(speM.id, alice);
|
const res = await show(speM.id, alice);
|
||||||
assert.strictEqual(res.body.text, '@target2 x');
|
assert.strictEqual(res.body.text, '@target2 x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-mentionを指定ユーザーが見れる', async () => {
|
test('[show] specified-mentionを指定ユーザーが見れる', async () => {
|
||||||
const res = await show(speM.id, target);
|
const res = await show(speM.id, target);
|
||||||
assert.strictEqual(res.body.text, '@target2 x');
|
assert.strictEqual(res.body.text, '@target2 x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-mentionをされた人が指定されてなかったら見れない', async () => {
|
test('[show] specified-mentionをされた人が指定されてなかったら見れない', async () => {
|
||||||
const res = await show(speM.id, target2);
|
const res = await show(speM.id, target2);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-mentionをフォロワーが見れない', async () => {
|
test('[show] specified-mentionをフォロワーが見れない', async () => {
|
||||||
const res = await show(speM.id, follower);
|
const res = await show(speM.id, follower);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-mentionを非フォロワーが見れない', async () => {
|
test('[show] specified-mentionを非フォロワーが見れない', async () => {
|
||||||
const res = await show(speM.id, other);
|
const res = await show(speM.id, other);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[show] specified-mentionを未認証が見れない', async () => {
|
test('[show] specified-mentionを未認証が見れない', async () => {
|
||||||
const res = await show(speM.id, null);
|
const res = await show(speM.id, null);
|
||||||
assert.strictEqual(res.body.isHidden, true);
|
assert.strictEqual(res.body.isHidden, true);
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region HTL
|
//#region HTL
|
||||||
it('[HTL] public-post が 自分が見れる', async () => {
|
test('[HTL] public-post が 自分が見れる', async () => {
|
||||||
const res = await request('/notes/timeline', { limit: 100 }, alice);
|
const res = await request('/notes/timeline', { limit: 100 }, alice);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
const notes = res.body.filter((n: any) => n.id === pub.id);
|
const notes = res.body.filter((n: any) => n.id === pub.id);
|
||||||
assert.strictEqual(notes[0].text, 'x');
|
assert.strictEqual(notes[0].text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[HTL] public-post が 非フォロワーから見れない', async () => {
|
test('[HTL] public-post が 非フォロワーから見れない', async () => {
|
||||||
const res = await request('/notes/timeline', { limit: 100 }, other);
|
const res = await request('/notes/timeline', { limit: 100 }, other);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
const notes = res.body.filter((n: any) => n.id === pub.id);
|
const notes = res.body.filter((n: any) => n.id === pub.id);
|
||||||
assert.strictEqual(notes.length, 0);
|
assert.strictEqual(notes.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[HTL] followers-post が フォロワーから見れる', async () => {
|
test('[HTL] followers-post が フォロワーから見れる', async () => {
|
||||||
const res = await request('/notes/timeline', { limit: 100 }, follower);
|
const res = await request('/notes/timeline', { limit: 100 }, follower);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
const notes = res.body.filter((n: any) => n.id === fol.id);
|
const notes = res.body.filter((n: any) => n.id === fol.id);
|
||||||
|
@ -435,21 +435,21 @@ describe('API visibility', () => {
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region RTL
|
//#region RTL
|
||||||
it('[replies] followers-reply が フォロワーから見れる', async () => {
|
test('[replies] followers-reply が フォロワーから見れる', async () => {
|
||||||
const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, follower);
|
const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, follower);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
const notes = res.body.filter((n: any) => n.id === folR.id);
|
const notes = res.body.filter((n: any) => n.id === folR.id);
|
||||||
assert.strictEqual(notes[0].text, 'x');
|
assert.strictEqual(notes[0].text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[replies] followers-reply が 非フォロワー (リプライ先ではない) から見れない', async () => {
|
test('[replies] followers-reply が 非フォロワー (リプライ先ではない) から見れない', async () => {
|
||||||
const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, other);
|
const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, other);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
const notes = res.body.filter((n: any) => n.id === folR.id);
|
const notes = res.body.filter((n: any) => n.id === folR.id);
|
||||||
assert.strictEqual(notes.length, 0);
|
assert.strictEqual(notes.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[replies] followers-reply が 非フォロワー (リプライ先である) から見れる', async () => {
|
test('[replies] followers-reply が 非フォロワー (リプライ先である) から見れる', async () => {
|
||||||
const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, target);
|
const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, target);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
const notes = res.body.filter((n: any) => n.id === folR.id);
|
const notes = res.body.filter((n: any) => n.id === folR.id);
|
||||||
|
@ -458,14 +458,14 @@ describe('API visibility', () => {
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region MTL
|
//#region MTL
|
||||||
it('[mentions] followers-reply が 非フォロワー (リプライ先である) から見れる', async () => {
|
test('[mentions] followers-reply が 非フォロワー (リプライ先である) から見れる', async () => {
|
||||||
const res = await request('/notes/mentions', { limit: 100 }, target);
|
const res = await request('/notes/mentions', { limit: 100 }, target);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
const notes = res.body.filter((n: any) => n.id === folR.id);
|
const notes = res.body.filter((n: any) => n.id === folR.id);
|
||||||
assert.strictEqual(notes[0].text, 'x');
|
assert.strictEqual(notes[0].text, 'x');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[mentions] followers-mention が 非フォロワー (メンション先である) から見れる', async () => {
|
test('[mentions] followers-mention が 非フォロワー (メンション先である) から見れる', async () => {
|
||||||
const res = await request('/notes/mentions', { limit: 100 }, target);
|
const res = await request('/notes/mentions', { limit: 100 }, target);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
const notes = res.body.filter((n: any) => n.id === folM.id);
|
const notes = res.body.filter((n: any) => n.id === folM.id);
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe('API', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('General validation', () => {
|
describe('General validation', () => {
|
||||||
it('wrong type', async(async () => {
|
test('wrong type', async(async () => {
|
||||||
const res = await request('/test', {
|
const res = await request('/test', {
|
||||||
required: true,
|
required: true,
|
||||||
string: 42,
|
string: 42,
|
||||||
|
@ -30,14 +30,14 @@ describe('API', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('missing require param', async(async () => {
|
test('missing require param', async(async () => {
|
||||||
const res = await request('/test', {
|
const res = await request('/test', {
|
||||||
string: 'a',
|
string: 'a',
|
||||||
});
|
});
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('invalid misskey:id (empty string)', async(async () => {
|
test('invalid misskey:id (empty string)', async(async () => {
|
||||||
const res = await request('/test', {
|
const res = await request('/test', {
|
||||||
required: true,
|
required: true,
|
||||||
id: '',
|
id: '',
|
||||||
|
@ -45,7 +45,7 @@ describe('API', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('valid misskey:id', async(async () => {
|
test('valid misskey:id', async(async () => {
|
||||||
const res = await request('/test', {
|
const res = await request('/test', {
|
||||||
required: true,
|
required: true,
|
||||||
id: '8wvhjghbxu',
|
id: '8wvhjghbxu',
|
||||||
|
@ -53,7 +53,7 @@ describe('API', () => {
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('default value', async(async () => {
|
test('default value', async(async () => {
|
||||||
const res = await request('/test', {
|
const res = await request('/test', {
|
||||||
required: true,
|
required: true,
|
||||||
string: 'a',
|
string: 'a',
|
||||||
|
@ -62,7 +62,7 @@ describe('API', () => {
|
||||||
assert.strictEqual(res.body.default, 'hello');
|
assert.strictEqual(res.body.default, 'hello');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('can set null even if it has default value', async(async () => {
|
test('can set null even if it has default value', async(async () => {
|
||||||
const res = await request('/test', {
|
const res = await request('/test', {
|
||||||
required: true,
|
required: true,
|
||||||
nullableDefault: null,
|
nullableDefault: null,
|
||||||
|
@ -71,7 +71,7 @@ describe('API', () => {
|
||||||
assert.strictEqual(res.body.nullableDefault, null);
|
assert.strictEqual(res.body.nullableDefault, null);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('cannot set undefined if it has default value', async(async () => {
|
test('cannot set undefined if it has default value', async(async () => {
|
||||||
const res = await request('/test', {
|
const res = await request('/test', {
|
||||||
required: true,
|
required: true,
|
||||||
nullableDefault: undefined,
|
nullableDefault: undefined,
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe('Block', () => {
|
||||||
await shutdownServer(p);
|
await shutdownServer(p);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Block作成', async () => {
|
test('Block作成', async () => {
|
||||||
const res = await request('/blocking/create', {
|
const res = await request('/blocking/create', {
|
||||||
userId: bob.id,
|
userId: bob.id,
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -31,14 +31,14 @@ describe('Block', () => {
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ブロックされているユーザーをフォローできない', async () => {
|
test('ブロックされているユーザーをフォローできない', async () => {
|
||||||
const res = await request('/following/create', { userId: alice.id }, bob);
|
const res = await request('/following/create', { userId: alice.id }, bob);
|
||||||
|
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
assert.strictEqual(res.body.error.id, 'c4ab57cc-4e41-45e9-bfd9-584f61e35ce0');
|
assert.strictEqual(res.body.error.id, 'c4ab57cc-4e41-45e9-bfd9-584f61e35ce0');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ブロックされているユーザーにリアクションできない', async () => {
|
test('ブロックされているユーザーにリアクションできない', async () => {
|
||||||
const note = await post(alice, { text: 'hello' });
|
const note = await post(alice, { text: 'hello' });
|
||||||
|
|
||||||
const res = await request('/notes/reactions/create', { noteId: note.id, reaction: '👍' }, bob);
|
const res = await request('/notes/reactions/create', { noteId: note.id, reaction: '👍' }, bob);
|
||||||
|
@ -47,7 +47,7 @@ describe('Block', () => {
|
||||||
assert.strictEqual(res.body.error.id, '20ef5475-9f38-4e4c-bd33-de6d979498ec');
|
assert.strictEqual(res.body.error.id, '20ef5475-9f38-4e4c-bd33-de6d979498ec');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ブロックされているユーザーに返信できない', async () => {
|
test('ブロックされているユーザーに返信できない', async () => {
|
||||||
const note = await post(alice, { text: 'hello' });
|
const note = await post(alice, { text: 'hello' });
|
||||||
|
|
||||||
const res = await request('/notes/create', { replyId: note.id, text: 'yo' }, bob);
|
const res = await request('/notes/create', { replyId: note.id, text: 'yo' }, bob);
|
||||||
|
@ -56,7 +56,7 @@ describe('Block', () => {
|
||||||
assert.strictEqual(res.body.error.id, 'b390d7e1-8a5e-46ed-b625-06271cafd3d3');
|
assert.strictEqual(res.body.error.id, 'b390d7e1-8a5e-46ed-b625-06271cafd3d3');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ブロックされているユーザーのノートをRenoteできない', async () => {
|
test('ブロックされているユーザーのノートをRenoteできない', async () => {
|
||||||
const note = await post(alice, { text: 'hello' });
|
const note = await post(alice, { text: 'hello' });
|
||||||
|
|
||||||
const res = await request('/notes/create', { renoteId: note.id, text: 'yo' }, bob);
|
const res = await request('/notes/create', { renoteId: note.id, text: 'yo' }, bob);
|
||||||
|
@ -69,7 +69,7 @@ describe('Block', () => {
|
||||||
|
|
||||||
// TODO: ユーザーリストから除外されるテスト
|
// TODO: ユーザーリストから除外されるテスト
|
||||||
|
|
||||||
it('タイムライン(LTL)にブロックされているユーザーの投稿が含まれない', async () => {
|
test('タイムライン(LTL)にブロックされているユーザーの投稿が含まれない', async () => {
|
||||||
const aliceNote = await post(alice);
|
const aliceNote = await post(alice);
|
||||||
const bobNote = await post(bob);
|
const bobNote = await post(bob);
|
||||||
const carolNote = await post(carol);
|
const carolNote = await post(carol);
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe('Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('signup', () => {
|
describe('signup', () => {
|
||||||
it('不正なユーザー名でアカウントが作成できない', async () => {
|
test('不正なユーザー名でアカウントが作成できない', async () => {
|
||||||
const res = await request('api/signup', {
|
const res = await request('api/signup', {
|
||||||
username: 'test.',
|
username: 'test.',
|
||||||
password: 'test',
|
password: 'test',
|
||||||
|
@ -30,7 +30,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('空のパスワードでアカウントが作成できない', async () => {
|
test('空のパスワードでアカウントが作成できない', async () => {
|
||||||
const res = await request('api/signup', {
|
const res = await request('api/signup', {
|
||||||
username: 'test',
|
username: 'test',
|
||||||
password: '',
|
password: '',
|
||||||
|
@ -38,7 +38,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('正しくアカウントが作成できる', async () => {
|
test('正しくアカウントが作成できる', async () => {
|
||||||
const me = {
|
const me = {
|
||||||
username: 'test1',
|
username: 'test1',
|
||||||
password: 'test1',
|
password: 'test1',
|
||||||
|
@ -51,7 +51,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.body.username, me.username);
|
assert.strictEqual(res.body.username, me.username);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('同じユーザー名のアカウントは作成できない', async () => {
|
test('同じユーザー名のアカウントは作成できない', async () => {
|
||||||
const res = await request('api/signup', {
|
const res = await request('api/signup', {
|
||||||
username: 'test1',
|
username: 'test1',
|
||||||
password: 'test1',
|
password: 'test1',
|
||||||
|
@ -62,7 +62,7 @@ describe('Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('signin', () => {
|
describe('signin', () => {
|
||||||
it('間違ったパスワードでサインインできない', async () => {
|
test('間違ったパスワードでサインインできない', async () => {
|
||||||
const res = await request('api/signin', {
|
const res = await request('api/signin', {
|
||||||
username: 'test1',
|
username: 'test1',
|
||||||
password: 'bar',
|
password: 'bar',
|
||||||
|
@ -71,7 +71,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 403);
|
assert.strictEqual(res.status, 403);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('クエリをインジェクションできない', async () => {
|
test('クエリをインジェクションできない', async () => {
|
||||||
const res = await request('api/signin', {
|
const res = await request('api/signin', {
|
||||||
username: 'test1',
|
username: 'test1',
|
||||||
password: {
|
password: {
|
||||||
|
@ -82,7 +82,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('正しい情報でサインインできる', async () => {
|
test('正しい情報でサインインできる', async () => {
|
||||||
const res = await request('api/signin', {
|
const res = await request('api/signin', {
|
||||||
username: 'test1',
|
username: 'test1',
|
||||||
password: 'test1',
|
password: 'test1',
|
||||||
|
@ -93,7 +93,7 @@ describe('Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('i/update', () => {
|
describe('i/update', () => {
|
||||||
it('アカウント設定を更新できる', async () => {
|
test('アカウント設定を更新できる', async () => {
|
||||||
const myName = '大室櫻子';
|
const myName = '大室櫻子';
|
||||||
const myLocation = '七森中';
|
const myLocation = '七森中';
|
||||||
const myBirthday = '2000-09-07';
|
const myBirthday = '2000-09-07';
|
||||||
|
@ -111,14 +111,14 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.body.birthday, myBirthday);
|
assert.strictEqual(res.body.birthday, myBirthday);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('名前を空白にできない', async () => {
|
test('名前を空白にできない', async () => {
|
||||||
const res = await api('/i/update', {
|
const res = await api('/i/update', {
|
||||||
name: ' ',
|
name: ' ',
|
||||||
}, alice);
|
}, alice);
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('誕生日の設定を削除できる', async () => {
|
test('誕生日の設定を削除できる', async () => {
|
||||||
await api('/i/update', {
|
await api('/i/update', {
|
||||||
birthday: '2000-09-07',
|
birthday: '2000-09-07',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -132,7 +132,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.body.birthday, null);
|
assert.strictEqual(res.body.birthday, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('不正な誕生日の形式で怒られる', async () => {
|
test('不正な誕生日の形式で怒られる', async () => {
|
||||||
const res = await api('/i/update', {
|
const res = await api('/i/update', {
|
||||||
birthday: '2000/09/07',
|
birthday: '2000/09/07',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -141,7 +141,7 @@ describe('Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('users/show', () => {
|
describe('users/show', () => {
|
||||||
it('ユーザーが取得できる', async () => {
|
test('ユーザーが取得できる', async () => {
|
||||||
const res = await api('/users/show', {
|
const res = await api('/users/show', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -151,14 +151,14 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.body.id, alice.id);
|
assert.strictEqual(res.body.id, alice.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ユーザーが存在しなかったら怒る', async () => {
|
test('ユーザーが存在しなかったら怒る', async () => {
|
||||||
const res = await api('/users/show', {
|
const res = await api('/users/show', {
|
||||||
userId: '000000000000000000000000',
|
userId: '000000000000000000000000',
|
||||||
});
|
});
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('間違ったIDで怒られる', async () => {
|
test('間違ったIDで怒られる', async () => {
|
||||||
const res = await api('/users/show', {
|
const res = await api('/users/show', {
|
||||||
userId: 'kyoppie',
|
userId: 'kyoppie',
|
||||||
});
|
});
|
||||||
|
@ -167,7 +167,7 @@ describe('Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('notes/show', () => {
|
describe('notes/show', () => {
|
||||||
it('投稿が取得できる', async () => {
|
test('投稿が取得できる', async () => {
|
||||||
const myPost = await post(alice, {
|
const myPost = await post(alice, {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
});
|
});
|
||||||
|
@ -182,14 +182,14 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.body.text, myPost.text);
|
assert.strictEqual(res.body.text, myPost.text);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('投稿が存在しなかったら怒る', async () => {
|
test('投稿が存在しなかったら怒る', async () => {
|
||||||
const res = await api('/notes/show', {
|
const res = await api('/notes/show', {
|
||||||
noteId: '000000000000000000000000',
|
noteId: '000000000000000000000000',
|
||||||
});
|
});
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('間違ったIDで怒られる', async () => {
|
test('間違ったIDで怒られる', async () => {
|
||||||
const res = await api('/notes/show', {
|
const res = await api('/notes/show', {
|
||||||
noteId: 'kyoppie',
|
noteId: 'kyoppie',
|
||||||
});
|
});
|
||||||
|
@ -198,7 +198,7 @@ describe('Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('notes/reactions/create', () => {
|
describe('notes/reactions/create', () => {
|
||||||
it('リアクションできる', async () => {
|
test('リアクションできる', async () => {
|
||||||
const bobPost = await post(bob);
|
const bobPost = await post(bob);
|
||||||
|
|
||||||
const alice = await signup({ username: 'alice' });
|
const alice = await signup({ username: 'alice' });
|
||||||
|
@ -217,7 +217,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(resNote.body.reactions['🚀'], [alice.id]);
|
assert.strictEqual(resNote.body.reactions['🚀'], [alice.id]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('自分の投稿にもリアクションできる', async () => {
|
test('自分の投稿にもリアクションできる', async () => {
|
||||||
const myPost = await post(alice);
|
const myPost = await post(alice);
|
||||||
|
|
||||||
const res = await api('/notes/reactions/create', {
|
const res = await api('/notes/reactions/create', {
|
||||||
|
@ -228,7 +228,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 204);
|
assert.strictEqual(res.status, 204);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('二重にリアクションできない', async () => {
|
test('二重にリアクションできない', async () => {
|
||||||
const bobPost = await post(bob);
|
const bobPost = await post(bob);
|
||||||
|
|
||||||
await api('/notes/reactions/create', {
|
await api('/notes/reactions/create', {
|
||||||
|
@ -244,7 +244,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('存在しない投稿にはリアクションできない', async () => {
|
test('存在しない投稿にはリアクションできない', async () => {
|
||||||
const res = await api('/notes/reactions/create', {
|
const res = await api('/notes/reactions/create', {
|
||||||
noteId: '000000000000000000000000',
|
noteId: '000000000000000000000000',
|
||||||
reaction: '🚀',
|
reaction: '🚀',
|
||||||
|
@ -253,13 +253,13 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('空のパラメータで怒られる', async () => {
|
test('空のパラメータで怒られる', async () => {
|
||||||
const res = await api('/notes/reactions/create', {}, alice);
|
const res = await api('/notes/reactions/create', {}, alice);
|
||||||
|
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('間違ったIDで怒られる', async () => {
|
test('間違ったIDで怒られる', async () => {
|
||||||
const res = await api('/notes/reactions/create', {
|
const res = await api('/notes/reactions/create', {
|
||||||
noteId: 'kyoppie',
|
noteId: 'kyoppie',
|
||||||
reaction: '🚀',
|
reaction: '🚀',
|
||||||
|
@ -270,7 +270,7 @@ describe('Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('following/create', () => {
|
describe('following/create', () => {
|
||||||
it('フォローできる', async () => {
|
test('フォローできる', async () => {
|
||||||
const res = await api('/following/create', {
|
const res = await api('/following/create', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
}, bob);
|
}, bob);
|
||||||
|
@ -278,7 +278,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('既にフォローしている場合は怒る', async () => {
|
test('既にフォローしている場合は怒る', async () => {
|
||||||
const res = await api('/following/create', {
|
const res = await api('/following/create', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
}, bob);
|
}, bob);
|
||||||
|
@ -286,7 +286,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('存在しないユーザーはフォローできない', async () => {
|
test('存在しないユーザーはフォローできない', async () => {
|
||||||
const res = await api('/following/create', {
|
const res = await api('/following/create', {
|
||||||
userId: '000000000000000000000000',
|
userId: '000000000000000000000000',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -294,7 +294,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('自分自身はフォローできない', async () => {
|
test('自分自身はフォローできない', async () => {
|
||||||
const res = await api('/following/create', {
|
const res = await api('/following/create', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -302,13 +302,13 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('空のパラメータで怒られる', async () => {
|
test('空のパラメータで怒られる', async () => {
|
||||||
const res = await api('/following/create', {}, alice);
|
const res = await api('/following/create', {}, alice);
|
||||||
|
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('間違ったIDで怒られる', async () => {
|
test('間違ったIDで怒られる', async () => {
|
||||||
const res = await api('/following/create', {
|
const res = await api('/following/create', {
|
||||||
userId: 'foo',
|
userId: 'foo',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -318,7 +318,7 @@ describe('Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('following/delete', () => {
|
describe('following/delete', () => {
|
||||||
it('フォロー解除できる', async () => {
|
test('フォロー解除できる', async () => {
|
||||||
await api('/following/create', {
|
await api('/following/create', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
}, bob);
|
}, bob);
|
||||||
|
@ -330,7 +330,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしていない場合は怒る', async () => {
|
test('フォローしていない場合は怒る', async () => {
|
||||||
const res = await api('/following/delete', {
|
const res = await api('/following/delete', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
}, bob);
|
}, bob);
|
||||||
|
@ -338,7 +338,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('存在しないユーザーはフォロー解除できない', async () => {
|
test('存在しないユーザーはフォロー解除できない', async () => {
|
||||||
const res = await api('/following/delete', {
|
const res = await api('/following/delete', {
|
||||||
userId: '000000000000000000000000',
|
userId: '000000000000000000000000',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -346,7 +346,7 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('自分自身はフォロー解除できない', async () => {
|
test('自分自身はフォロー解除できない', async () => {
|
||||||
const res = await api('/following/delete', {
|
const res = await api('/following/delete', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -354,13 +354,13 @@ describe('Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('空のパラメータで怒られる', async () => {
|
test('空のパラメータで怒られる', async () => {
|
||||||
const res = await api('/following/delete', {}, alice);
|
const res = await api('/following/delete', {}, alice);
|
||||||
|
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('間違ったIDで怒られる', async () => {
|
test('間違ったIDで怒られる', async () => {
|
||||||
const res = await api('/following/delete', {
|
const res = await api('/following/delete', {
|
||||||
userId: 'kyoppie',
|
userId: 'kyoppie',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -371,7 +371,7 @@ describe('Endpoints', () => {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
describe('/i', () => {
|
describe('/i', () => {
|
||||||
it('', async () => {
|
test('', async () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
@ -402,7 +402,7 @@ describe('API: Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('drive', () => {
|
describe('drive', () => {
|
||||||
it('ドライブ情報を取得できる', async () => {
|
test('ドライブ情報を取得できる', async () => {
|
||||||
await uploadFile({
|
await uploadFile({
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
size: 256
|
size: 256
|
||||||
|
@ -423,7 +423,7 @@ describe('API: Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('drive/files/create', () => {
|
describe('drive/files/create', () => {
|
||||||
it('ファイルを作成できる', async () => {
|
test('ファイルを作成できる', async () => {
|
||||||
const res = await uploadFile(alice);
|
const res = await uploadFile(alice);
|
||||||
|
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
|
@ -431,7 +431,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.body.name, 'Lenna.png');
|
assert.strictEqual(res.body.name, 'Lenna.png');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('ファイルに名前を付けられる', async () => {
|
test('ファイルに名前を付けられる', async () => {
|
||||||
const res = await assert.request(server)
|
const res = await assert.request(server)
|
||||||
.post('/drive/files/create')
|
.post('/drive/files/create')
|
||||||
.field('i', alice.token)
|
.field('i', alice.token)
|
||||||
|
@ -443,13 +443,13 @@ describe('API: Endpoints', () => {
|
||||||
expect(res.body).have.property('name').eql('Belmond.png');
|
expect(res.body).have.property('name').eql('Belmond.png');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('ファイル無しで怒られる', async () => {
|
test('ファイル無しで怒られる', async () => {
|
||||||
const res = await api('/drive/files/create', {}, alice);
|
const res = await api('/drive/files/create', {}, alice);
|
||||||
|
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('SVGファイルを作成できる', async () => {
|
test('SVGファイルを作成できる', async () => {
|
||||||
const res = await uploadFile(alice, __dirname + '/resources/image.svg');
|
const res = await uploadFile(alice, __dirname + '/resources/image.svg');
|
||||||
|
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
|
@ -460,7 +460,7 @@ describe('API: Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('drive/files/update', () => {
|
describe('drive/files/update', () => {
|
||||||
it('名前を更新できる', async () => {
|
test('名前を更新できる', async () => {
|
||||||
const file = await uploadFile(alice);
|
const file = await uploadFile(alice);
|
||||||
const newName = 'いちごパスタ.png';
|
const newName = 'いちごパスタ.png';
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.body.name, newName);
|
assert.strictEqual(res.body.name, newName);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('他人のファイルは更新できない', async () => {
|
test('他人のファイルは更新できない', async () => {
|
||||||
const file = await uploadFile(bob);
|
const file = await uploadFile(bob);
|
||||||
|
|
||||||
const res = await api('/drive/files/update', {
|
const res = await api('/drive/files/update', {
|
||||||
|
@ -485,7 +485,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('親フォルダを更新できる', async () => {
|
test('親フォルダを更新できる', async () => {
|
||||||
const file = await uploadFile(alice);
|
const file = await uploadFile(alice);
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
|
@ -501,7 +501,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.body.folderId, folder.id);
|
assert.strictEqual(res.body.folderId, folder.id);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('親フォルダを無しにできる', async () => {
|
test('親フォルダを無しにできる', async () => {
|
||||||
const file = await uploadFile(alice);
|
const file = await uploadFile(alice);
|
||||||
|
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
|
@ -523,7 +523,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.body.folderId, null);
|
assert.strictEqual(res.body.folderId, null);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('他人のフォルダには入れられない', async () => {
|
test('他人のフォルダには入れられない', async () => {
|
||||||
const file = await uploadFile(alice);
|
const file = await uploadFile(alice);
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
|
@ -537,7 +537,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('存在しないフォルダで怒られる', async () => {
|
test('存在しないフォルダで怒られる', async () => {
|
||||||
const file = await uploadFile(alice);
|
const file = await uploadFile(alice);
|
||||||
|
|
||||||
const res = await api('/drive/files/update', {
|
const res = await api('/drive/files/update', {
|
||||||
|
@ -548,7 +548,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('不正なフォルダIDで怒られる', async () => {
|
test('不正なフォルダIDで怒られる', async () => {
|
||||||
const file = await uploadFile(alice);
|
const file = await uploadFile(alice);
|
||||||
|
|
||||||
const res = await api('/drive/files/update', {
|
const res = await api('/drive/files/update', {
|
||||||
|
@ -559,7 +559,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('ファイルが存在しなかったら怒る', async () => {
|
test('ファイルが存在しなかったら怒る', async () => {
|
||||||
const res = await api('/drive/files/update', {
|
const res = await api('/drive/files/update', {
|
||||||
fileId: '000000000000000000000000',
|
fileId: '000000000000000000000000',
|
||||||
name: 'いちごパスタ.png'
|
name: 'いちごパスタ.png'
|
||||||
|
@ -568,7 +568,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('間違ったIDで怒られる', async () => {
|
test('間違ったIDで怒られる', async () => {
|
||||||
const res = await api('/drive/files/update', {
|
const res = await api('/drive/files/update', {
|
||||||
fileId: 'kyoppie',
|
fileId: 'kyoppie',
|
||||||
name: 'いちごパスタ.png'
|
name: 'いちごパスタ.png'
|
||||||
|
@ -579,7 +579,7 @@ describe('API: Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('drive/folders/create', () => {
|
describe('drive/folders/create', () => {
|
||||||
it('フォルダを作成できる', async () => {
|
test('フォルダを作成できる', async () => {
|
||||||
const res = await api('/drive/folders/create', {
|
const res = await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -591,7 +591,7 @@ describe('API: Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('drive/folders/update', () => {
|
describe('drive/folders/update', () => {
|
||||||
it('名前を更新できる', async () => {
|
test('名前を更新できる', async () => {
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice)).body;
|
}, alice)).body;
|
||||||
|
@ -606,7 +606,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.body.name, 'new name');
|
assert.strictEqual(res.body.name, 'new name');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('他人のフォルダを更新できない', async () => {
|
test('他人のフォルダを更新できない', async () => {
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, bob)).body;
|
}, bob)).body;
|
||||||
|
@ -619,7 +619,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('親フォルダを更新できる', async () => {
|
test('親フォルダを更新できる', async () => {
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice)).body;
|
}, alice)).body;
|
||||||
|
@ -637,7 +637,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.body.parentId, parentFolder.id);
|
assert.strictEqual(res.body.parentId, parentFolder.id);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('親フォルダを無しに更新できる', async () => {
|
test('親フォルダを無しに更新できる', async () => {
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice)).body;
|
}, alice)).body;
|
||||||
|
@ -659,7 +659,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.body.parentId, null);
|
assert.strictEqual(res.body.parentId, null);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('他人のフォルダを親フォルダに設定できない', async () => {
|
test('他人のフォルダを親フォルダに設定できない', async () => {
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice)).body;
|
}, alice)).body;
|
||||||
|
@ -675,7 +675,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('フォルダが循環するような構造にできない', async () => {
|
test('フォルダが循環するような構造にできない', async () => {
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice)).body;
|
}, alice)).body;
|
||||||
|
@ -695,7 +695,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('フォルダが循環するような構造にできない(再帰的)', async () => {
|
test('フォルダが循環するような構造にできない(再帰的)', async () => {
|
||||||
const folderA = (await api('/drive/folders/create', {
|
const folderA = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice)).body;
|
}, alice)).body;
|
||||||
|
@ -722,7 +722,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('フォルダが循環するような構造にできない(自身)', async () => {
|
test('フォルダが循環するような構造にできない(自身)', async () => {
|
||||||
const folderA = (await api('/drive/folders/create', {
|
const folderA = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice)).body;
|
}, alice)).body;
|
||||||
|
@ -735,7 +735,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('存在しない親フォルダを設定できない', async () => {
|
test('存在しない親フォルダを設定できない', async () => {
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice)).body;
|
}, alice)).body;
|
||||||
|
@ -748,7 +748,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('不正な親フォルダIDで怒られる', async () => {
|
test('不正な親フォルダIDで怒られる', async () => {
|
||||||
const folder = (await api('/drive/folders/create', {
|
const folder = (await api('/drive/folders/create', {
|
||||||
name: 'test'
|
name: 'test'
|
||||||
}, alice)).body;
|
}, alice)).body;
|
||||||
|
@ -761,7 +761,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('存在しないフォルダを更新できない', async () => {
|
test('存在しないフォルダを更新できない', async () => {
|
||||||
const res = await api('/drive/folders/update', {
|
const res = await api('/drive/folders/update', {
|
||||||
folderId: '000000000000000000000000'
|
folderId: '000000000000000000000000'
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -769,7 +769,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('不正なフォルダIDで怒られる', async () => {
|
test('不正なフォルダIDで怒られる', async () => {
|
||||||
const res = await api('/drive/folders/update', {
|
const res = await api('/drive/folders/update', {
|
||||||
folderId: 'foo'
|
folderId: 'foo'
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -779,7 +779,7 @@ describe('API: Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('messaging/messages/create', () => {
|
describe('messaging/messages/create', () => {
|
||||||
it('メッセージを送信できる', async () => {
|
test('メッセージを送信できる', async () => {
|
||||||
const res = await api('/messaging/messages/create', {
|
const res = await api('/messaging/messages/create', {
|
||||||
userId: bob.id,
|
userId: bob.id,
|
||||||
text: 'test'
|
text: 'test'
|
||||||
|
@ -790,7 +790,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.body.text, 'test');
|
assert.strictEqual(res.body.text, 'test');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('自分自身にはメッセージを送信できない', async () => {
|
test('自分自身にはメッセージを送信できない', async () => {
|
||||||
const res = await api('/messaging/messages/create', {
|
const res = await api('/messaging/messages/create', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
text: 'Yo'
|
text: 'Yo'
|
||||||
|
@ -799,7 +799,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('存在しないユーザーにはメッセージを送信できない', async () => {
|
test('存在しないユーザーにはメッセージを送信できない', async () => {
|
||||||
const res = await api('/messaging/messages/create', {
|
const res = await api('/messaging/messages/create', {
|
||||||
userId: '000000000000000000000000',
|
userId: '000000000000000000000000',
|
||||||
text: 'test'
|
text: 'test'
|
||||||
|
@ -808,7 +808,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('不正なユーザーIDで怒られる', async () => {
|
test('不正なユーザーIDで怒られる', async () => {
|
||||||
const res = await api('/messaging/messages/create', {
|
const res = await api('/messaging/messages/create', {
|
||||||
userId: 'foo',
|
userId: 'foo',
|
||||||
text: 'test'
|
text: 'test'
|
||||||
|
@ -817,7 +817,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('テキストが無くて怒られる', async () => {
|
test('テキストが無くて怒られる', async () => {
|
||||||
const res = await api('/messaging/messages/create', {
|
const res = await api('/messaging/messages/create', {
|
||||||
userId: bob.id
|
userId: bob.id
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -825,7 +825,7 @@ describe('API: Endpoints', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('文字数オーバーで怒られる', async () => {
|
test('文字数オーバーで怒られる', async () => {
|
||||||
const res = await api('/messaging/messages/create', {
|
const res = await api('/messaging/messages/create', {
|
||||||
userId: bob.id,
|
userId: bob.id,
|
||||||
text: '!'.repeat(1001)
|
text: '!'.repeat(1001)
|
||||||
|
@ -836,7 +836,7 @@ describe('API: Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('notes/replies', () => {
|
describe('notes/replies', () => {
|
||||||
it('自分に閲覧権限のない投稿は含まれない', async () => {
|
test('自分に閲覧権限のない投稿は含まれない', async () => {
|
||||||
const alicePost = await post(alice, {
|
const alicePost = await post(alice, {
|
||||||
text: 'foo'
|
text: 'foo'
|
||||||
});
|
});
|
||||||
|
@ -859,7 +859,7 @@ describe('API: Endpoints', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('notes/timeline', () => {
|
describe('notes/timeline', () => {
|
||||||
it('フォロワー限定投稿が含まれる', async () => {
|
test('フォロワー限定投稿が含まれる', async () => {
|
||||||
await api('/following/create', {
|
await api('/following/create', {
|
||||||
userId: alice.id
|
userId: alice.id
|
||||||
}, bob);
|
}, bob);
|
||||||
|
|
|
@ -35,38 +35,38 @@ describe('Fetch resource', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Common', () => {
|
describe('Common', () => {
|
||||||
it('meta', async () => {
|
test('meta', async () => {
|
||||||
const res = await request('/meta', {
|
const res = await request('/meta', {
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('GET root', async () => {
|
test('GET root', async () => {
|
||||||
const res = await simpleGet('/');
|
const res = await simpleGet('/');
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, HTML);
|
assert.strictEqual(res.type, HTML);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('GET docs', async () => {
|
test('GET docs', async () => {
|
||||||
const res = await simpleGet('/docs/ja-JP/about');
|
const res = await simpleGet('/docs/ja-JP/about');
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, HTML);
|
assert.strictEqual(res.type, HTML);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('GET api-doc', async () => {
|
test('GET api-doc', async () => {
|
||||||
const res = await simpleGet('/api-doc');
|
const res = await simpleGet('/api-doc');
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, HTML);
|
assert.strictEqual(res.type, HTML);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('GET api.json', async () => {
|
test('GET api.json', async () => {
|
||||||
const res = await simpleGet('/api.json');
|
const res = await simpleGet('/api.json');
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, JSON);
|
assert.strictEqual(res.type, JSON);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Validate api.json', async () => {
|
test('Validate api.json', async () => {
|
||||||
const config = await openapi.loadConfig();
|
const config = await openapi.loadConfig();
|
||||||
const result = await openapi.bundle({
|
const result = await openapi.bundle({
|
||||||
config,
|
config,
|
||||||
|
@ -80,25 +80,25 @@ describe('Fetch resource', () => {
|
||||||
assert.strictEqual(result.problems.length, 0);
|
assert.strictEqual(result.problems.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('GET favicon.ico', async () => {
|
test('GET favicon.ico', async () => {
|
||||||
const res = await simpleGet('/favicon.ico');
|
const res = await simpleGet('/favicon.ico');
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, 'image/x-icon');
|
assert.strictEqual(res.type, 'image/x-icon');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('GET apple-touch-icon.png', async () => {
|
test('GET apple-touch-icon.png', async () => {
|
||||||
const res = await simpleGet('/apple-touch-icon.png');
|
const res = await simpleGet('/apple-touch-icon.png');
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, 'image/png');
|
assert.strictEqual(res.type, 'image/png');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('GET twemoji svg', async () => {
|
test('GET twemoji svg', async () => {
|
||||||
const res = await simpleGet('/twemoji/2764.svg');
|
const res = await simpleGet('/twemoji/2764.svg');
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, 'image/svg+xml');
|
assert.strictEqual(res.type, 'image/svg+xml');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('GET twemoji svg with hyphen', async () => {
|
test('GET twemoji svg with hyphen', async () => {
|
||||||
const res = await simpleGet('/twemoji/2764-fe0f-200d-1f525.svg');
|
const res = await simpleGet('/twemoji/2764-fe0f-200d-1f525.svg');
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, 'image/svg+xml');
|
assert.strictEqual(res.type, 'image/svg+xml');
|
||||||
|
@ -106,25 +106,25 @@ describe('Fetch resource', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('/@:username', () => {
|
describe('/@:username', () => {
|
||||||
it('Only AP => AP', async () => {
|
test('Only AP => AP', async () => {
|
||||||
const res = await simpleGet(`/@${alice.username}`, ONLY_AP);
|
const res = await simpleGet(`/@${alice.username}`, ONLY_AP);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, AP);
|
assert.strictEqual(res.type, AP);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Prefer AP => AP', async () => {
|
test('Prefer AP => AP', async () => {
|
||||||
const res = await simpleGet(`/@${alice.username}`, PREFER_AP);
|
const res = await simpleGet(`/@${alice.username}`, PREFER_AP);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, AP);
|
assert.strictEqual(res.type, AP);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Prefer HTML => HTML', async () => {
|
test('Prefer HTML => HTML', async () => {
|
||||||
const res = await simpleGet(`/@${alice.username}`, PREFER_HTML);
|
const res = await simpleGet(`/@${alice.username}`, PREFER_HTML);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, HTML);
|
assert.strictEqual(res.type, HTML);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Unspecified => HTML', async () => {
|
test('Unspecified => HTML', async () => {
|
||||||
const res = await simpleGet(`/@${alice.username}`, UNSPECIFIED);
|
const res = await simpleGet(`/@${alice.username}`, UNSPECIFIED);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, HTML);
|
assert.strictEqual(res.type, HTML);
|
||||||
|
@ -132,25 +132,25 @@ describe('Fetch resource', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('/users/:id', () => {
|
describe('/users/:id', () => {
|
||||||
it('Only AP => AP', async () => {
|
test('Only AP => AP', async () => {
|
||||||
const res = await simpleGet(`/users/${alice.id}`, ONLY_AP);
|
const res = await simpleGet(`/users/${alice.id}`, ONLY_AP);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, AP);
|
assert.strictEqual(res.type, AP);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Prefer AP => AP', async () => {
|
test('Prefer AP => AP', async () => {
|
||||||
const res = await simpleGet(`/users/${alice.id}`, PREFER_AP);
|
const res = await simpleGet(`/users/${alice.id}`, PREFER_AP);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, AP);
|
assert.strictEqual(res.type, AP);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Prefer HTML => Redirect to /@:username', async () => {
|
test('Prefer HTML => Redirect to /@:username', async () => {
|
||||||
const res = await simpleGet(`/users/${alice.id}`, PREFER_HTML);
|
const res = await simpleGet(`/users/${alice.id}`, PREFER_HTML);
|
||||||
assert.strictEqual(res.status, 302);
|
assert.strictEqual(res.status, 302);
|
||||||
assert.strictEqual(res.location, `/@${alice.username}`);
|
assert.strictEqual(res.location, `/@${alice.username}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Undecided => HTML', async () => {
|
test('Undecided => HTML', async () => {
|
||||||
const res = await simpleGet(`/users/${alice.id}`, UNSPECIFIED);
|
const res = await simpleGet(`/users/${alice.id}`, UNSPECIFIED);
|
||||||
assert.strictEqual(res.status, 302);
|
assert.strictEqual(res.status, 302);
|
||||||
assert.strictEqual(res.location, `/@${alice.username}`);
|
assert.strictEqual(res.location, `/@${alice.username}`);
|
||||||
|
@ -158,25 +158,25 @@ describe('Fetch resource', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('/notes/:id', () => {
|
describe('/notes/:id', () => {
|
||||||
it('Only AP => AP', async () => {
|
test('Only AP => AP', async () => {
|
||||||
const res = await simpleGet(`/notes/${alicesPost.id}`, ONLY_AP);
|
const res = await simpleGet(`/notes/${alicesPost.id}`, ONLY_AP);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, AP);
|
assert.strictEqual(res.type, AP);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Prefer AP => AP', async () => {
|
test('Prefer AP => AP', async () => {
|
||||||
const res = await simpleGet(`/notes/${alicesPost.id}`, PREFER_AP);
|
const res = await simpleGet(`/notes/${alicesPost.id}`, PREFER_AP);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, AP);
|
assert.strictEqual(res.type, AP);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Prefer HTML => HTML', async () => {
|
test('Prefer HTML => HTML', async () => {
|
||||||
const res = await simpleGet(`/notes/${alicesPost.id}`, PREFER_HTML);
|
const res = await simpleGet(`/notes/${alicesPost.id}`, PREFER_HTML);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, HTML);
|
assert.strictEqual(res.type, HTML);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Unspecified => HTML', async () => {
|
test('Unspecified => HTML', async () => {
|
||||||
const res = await simpleGet(`/notes/${alicesPost.id}`, UNSPECIFIED);
|
const res = await simpleGet(`/notes/${alicesPost.id}`, UNSPECIFIED);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, HTML);
|
assert.strictEqual(res.type, HTML);
|
||||||
|
@ -184,19 +184,19 @@ describe('Fetch resource', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Feeds', () => {
|
describe('Feeds', () => {
|
||||||
it('RSS', async () => {
|
test('RSS', async () => {
|
||||||
const res = await simpleGet(`/@${alice.username}.rss`, UNSPECIFIED);
|
const res = await simpleGet(`/@${alice.username}.rss`, UNSPECIFIED);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, 'application/rss+xml; charset=utf-8');
|
assert.strictEqual(res.type, 'application/rss+xml; charset=utf-8');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ATOM', async () => {
|
test('ATOM', async () => {
|
||||||
const res = await simpleGet(`/@${alice.username}.atom`, UNSPECIFIED);
|
const res = await simpleGet(`/@${alice.username}.atom`, UNSPECIFIED);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, 'application/atom+xml; charset=utf-8');
|
assert.strictEqual(res.type, 'application/atom+xml; charset=utf-8');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('JSON', async () => {
|
test('JSON', async () => {
|
||||||
const res = await simpleGet(`/@${alice.username}.json`, UNSPECIFIED);
|
const res = await simpleGet(`/@${alice.username}.json`, UNSPECIFIED);
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
assert.strictEqual(res.type, 'application/json; charset=utf-8');
|
assert.strictEqual(res.type, 'application/json; charset=utf-8');
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe('FF visibility', () => {
|
||||||
await shutdownServer(p);
|
await shutdownServer(p);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ffVisibility が public なユーザーのフォロー/フォロワーを誰でも見れる', async () => {
|
test('ffVisibility が public なユーザーのフォロー/フォロワーを誰でも見れる', async () => {
|
||||||
await request('/i/update', {
|
await request('/i/update', {
|
||||||
ffVisibility: 'public',
|
ffVisibility: 'public',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -40,7 +40,7 @@ describe('FF visibility', () => {
|
||||||
assert.strictEqual(Array.isArray(followersRes.body), true);
|
assert.strictEqual(Array.isArray(followersRes.body), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ffVisibility が followers なユーザーのフォロー/フォロワーを自分で見れる', async () => {
|
test('ffVisibility が followers なユーザーのフォロー/フォロワーを自分で見れる', async () => {
|
||||||
await request('/i/update', {
|
await request('/i/update', {
|
||||||
ffVisibility: 'followers',
|
ffVisibility: 'followers',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -58,7 +58,7 @@ describe('FF visibility', () => {
|
||||||
assert.strictEqual(Array.isArray(followersRes.body), true);
|
assert.strictEqual(Array.isArray(followersRes.body), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ffVisibility が followers なユーザーのフォロー/フォロワーを非フォロワーが見れない', async () => {
|
test('ffVisibility が followers なユーザーのフォロー/フォロワーを非フォロワーが見れない', async () => {
|
||||||
await request('/i/update', {
|
await request('/i/update', {
|
||||||
ffVisibility: 'followers',
|
ffVisibility: 'followers',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -74,7 +74,7 @@ describe('FF visibility', () => {
|
||||||
assert.strictEqual(followersRes.status, 400);
|
assert.strictEqual(followersRes.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ffVisibility が followers なユーザーのフォロー/フォロワーをフォロワーが見れる', async () => {
|
test('ffVisibility が followers なユーザーのフォロー/フォロワーをフォロワーが見れる', async () => {
|
||||||
await request('/i/update', {
|
await request('/i/update', {
|
||||||
ffVisibility: 'followers',
|
ffVisibility: 'followers',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -96,7 +96,7 @@ describe('FF visibility', () => {
|
||||||
assert.strictEqual(Array.isArray(followersRes.body), true);
|
assert.strictEqual(Array.isArray(followersRes.body), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ffVisibility が private なユーザーのフォロー/フォロワーを自分で見れる', async () => {
|
test('ffVisibility が private なユーザーのフォロー/フォロワーを自分で見れる', async () => {
|
||||||
await request('/i/update', {
|
await request('/i/update', {
|
||||||
ffVisibility: 'private',
|
ffVisibility: 'private',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -114,7 +114,7 @@ describe('FF visibility', () => {
|
||||||
assert.strictEqual(Array.isArray(followersRes.body), true);
|
assert.strictEqual(Array.isArray(followersRes.body), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ffVisibility が private なユーザーのフォロー/フォロワーを他人が見れない', async () => {
|
test('ffVisibility が private なユーザーのフォロー/フォロワーを他人が見れない', async () => {
|
||||||
await request('/i/update', {
|
await request('/i/update', {
|
||||||
ffVisibility: 'private',
|
ffVisibility: 'private',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -131,7 +131,7 @@ describe('FF visibility', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('AP', () => {
|
describe('AP', () => {
|
||||||
it('ffVisibility が public 以外ならばAPからは取得できない', async () => {
|
test('ffVisibility が public 以外ならばAPからは取得できない', async () => {
|
||||||
{
|
{
|
||||||
await request('/i/update', {
|
await request('/i/update', {
|
||||||
ffVisibility: 'public',
|
ffVisibility: 'public',
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe('Mute', () => {
|
||||||
await shutdownServer(p);
|
await shutdownServer(p);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ミュート作成', async () => {
|
test('ミュート作成', async () => {
|
||||||
const res = await request('/mute/create', {
|
const res = await request('/mute/create', {
|
||||||
userId: carol.id,
|
userId: carol.id,
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -31,7 +31,7 @@ describe('Mute', () => {
|
||||||
assert.strictEqual(res.status, 204);
|
assert.strictEqual(res.status, 204);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('「自分宛ての投稿」にミュートしているユーザーの投稿が含まれない', async () => {
|
test('「自分宛ての投稿」にミュートしているユーザーの投稿が含まれない', async () => {
|
||||||
const bobNote = await post(bob, { text: '@alice hi' });
|
const bobNote = await post(bob, { text: '@alice hi' });
|
||||||
const carolNote = await post(carol, { text: '@alice hi' });
|
const carolNote = await post(carol, { text: '@alice hi' });
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ describe('Mute', () => {
|
||||||
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false);
|
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ミュートしているユーザーからメンションされても、hasUnreadMentions が true にならない', async () => {
|
test('ミュートしているユーザーからメンションされても、hasUnreadMentions が true にならない', async () => {
|
||||||
// 状態リセット
|
// 状態リセット
|
||||||
await request('/i/read-all-unread-notes', {}, alice);
|
await request('/i/read-all-unread-notes', {}, alice);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ describe('Mute', () => {
|
||||||
assert.strictEqual(res.body.hasUnreadMentions, false);
|
assert.strictEqual(res.body.hasUnreadMentions, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ミュートしているユーザーからメンションされても、ストリームに unreadMention イベントが流れてこない', async () => {
|
test('ミュートしているユーザーからメンションされても、ストリームに unreadMention イベントが流れてこない', async () => {
|
||||||
// 状態リセット
|
// 状態リセット
|
||||||
await request('/i/read-all-unread-notes', {}, alice);
|
await request('/i/read-all-unread-notes', {}, alice);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ describe('Mute', () => {
|
||||||
assert.strictEqual(fired, false);
|
assert.strictEqual(fired, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ミュートしているユーザーからメンションされても、ストリームに unreadNotification イベントが流れてこない', async () => {
|
test('ミュートしているユーザーからメンションされても、ストリームに unreadNotification イベントが流れてこない', async () => {
|
||||||
// 状態リセット
|
// 状態リセット
|
||||||
await request('/i/read-all-unread-notes', {}, alice);
|
await request('/i/read-all-unread-notes', {}, alice);
|
||||||
await request('/notifications/mark-all-as-read', {}, alice);
|
await request('/notifications/mark-all-as-read', {}, alice);
|
||||||
|
@ -75,7 +75,7 @@ describe('Mute', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Timeline', () => {
|
describe('Timeline', () => {
|
||||||
it('タイムラインにミュートしているユーザーの投稿が含まれない', async () => {
|
test('タイムラインにミュートしているユーザーの投稿が含まれない', async () => {
|
||||||
const aliceNote = await post(alice);
|
const aliceNote = await post(alice);
|
||||||
const bobNote = await post(bob);
|
const bobNote = await post(bob);
|
||||||
const carolNote = await post(carol);
|
const carolNote = await post(carol);
|
||||||
|
@ -89,7 +89,7 @@ describe('Mute', () => {
|
||||||
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false);
|
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('タイムラインにミュートしているユーザーの投稿のRenoteが含まれない', async () => {
|
test('タイムラインにミュートしているユーザーの投稿のRenoteが含まれない', async () => {
|
||||||
const aliceNote = await post(alice);
|
const aliceNote = await post(alice);
|
||||||
const carolNote = await post(carol);
|
const carolNote = await post(carol);
|
||||||
const bobNote = await post(bob, {
|
const bobNote = await post(bob, {
|
||||||
|
@ -107,7 +107,7 @@ describe('Mute', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Notification', () => {
|
describe('Notification', () => {
|
||||||
it('通知にミュートしているユーザーの通知が含まれない(リアクション)', async () => {
|
test('通知にミュートしているユーザーの通知が含まれない(リアクション)', async () => {
|
||||||
const aliceNote = await post(alice);
|
const aliceNote = await post(alice);
|
||||||
await react(bob, aliceNote, 'like');
|
await react(bob, aliceNote, 'like');
|
||||||
await react(carol, aliceNote, 'like');
|
await react(carol, aliceNote, 'like');
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe('Note', () => {
|
||||||
await shutdownServer(p);
|
await shutdownServer(p);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('投稿できる', async () => {
|
test('投稿できる', async () => {
|
||||||
const post = {
|
const post = {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
};
|
};
|
||||||
|
@ -36,7 +36,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.body.createdNote.text, post.text);
|
assert.strictEqual(res.body.createdNote.text, post.text);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ファイルを添付できる', async () => {
|
test('ファイルを添付できる', async () => {
|
||||||
const file = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg');
|
const file = await uploadUrl(alice, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg');
|
||||||
|
|
||||||
const res = await request('/notes/create', {
|
const res = await request('/notes/create', {
|
||||||
|
@ -48,7 +48,7 @@ describe('Note', () => {
|
||||||
assert.deepStrictEqual(res.body.createdNote.fileIds, [file.id]);
|
assert.deepStrictEqual(res.body.createdNote.fileIds, [file.id]);
|
||||||
}, 1000 * 10);
|
}, 1000 * 10);
|
||||||
|
|
||||||
it('他人のファイルは無視', async () => {
|
test('他人のファイルは無視', async () => {
|
||||||
const file = await uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg');
|
const file = await uploadUrl(bob, 'https://raw.githubusercontent.com/misskey-dev/misskey/develop/packages/backend/test/resources/Lenna.jpg');
|
||||||
|
|
||||||
const res = await request('/notes/create', {
|
const res = await request('/notes/create', {
|
||||||
|
@ -61,7 +61,7 @@ describe('Note', () => {
|
||||||
assert.deepStrictEqual(res.body.createdNote.fileIds, []);
|
assert.deepStrictEqual(res.body.createdNote.fileIds, []);
|
||||||
}, 1000 * 10);
|
}, 1000 * 10);
|
||||||
|
|
||||||
it('存在しないファイルは無視', async () => {
|
test('存在しないファイルは無視', async () => {
|
||||||
const res = await request('/notes/create', {
|
const res = await request('/notes/create', {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
fileIds: ['000000000000000000000000'],
|
fileIds: ['000000000000000000000000'],
|
||||||
|
@ -72,7 +72,7 @@ describe('Note', () => {
|
||||||
assert.deepStrictEqual(res.body.createdNote.fileIds, []);
|
assert.deepStrictEqual(res.body.createdNote.fileIds, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('不正なファイルIDは無視', async () => {
|
test('不正なファイルIDは無視', async () => {
|
||||||
const res = await request('/notes/create', {
|
const res = await request('/notes/create', {
|
||||||
fileIds: ['kyoppie'],
|
fileIds: ['kyoppie'],
|
||||||
}, alice);
|
}, alice);
|
||||||
|
@ -81,7 +81,7 @@ describe('Note', () => {
|
||||||
assert.deepStrictEqual(res.body.createdNote.fileIds, []);
|
assert.deepStrictEqual(res.body.createdNote.fileIds, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('返信できる', async () => {
|
test('返信できる', async () => {
|
||||||
const bobPost = await post(bob, {
|
const bobPost = await post(bob, {
|
||||||
text: 'foo',
|
text: 'foo',
|
||||||
});
|
});
|
||||||
|
@ -100,7 +100,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.body.createdNote.reply.text, bobPost.text);
|
assert.strictEqual(res.body.createdNote.reply.text, bobPost.text);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renoteできる', async () => {
|
test('renoteできる', async () => {
|
||||||
const bobPost = await post(bob, {
|
const bobPost = await post(bob, {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
});
|
});
|
||||||
|
@ -117,7 +117,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.body.createdNote.renote.text, bobPost.text);
|
assert.strictEqual(res.body.createdNote.renote.text, bobPost.text);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('引用renoteできる', async () => {
|
test('引用renoteできる', async () => {
|
||||||
const bobPost = await post(bob, {
|
const bobPost = await post(bob, {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
});
|
});
|
||||||
|
@ -136,7 +136,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.body.createdNote.renote.text, bobPost.text);
|
assert.strictEqual(res.body.createdNote.renote.text, bobPost.text);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('文字数ぎりぎりで怒られない', async () => {
|
test('文字数ぎりぎりで怒られない', async () => {
|
||||||
const post = {
|
const post = {
|
||||||
text: '!'.repeat(3000),
|
text: '!'.repeat(3000),
|
||||||
};
|
};
|
||||||
|
@ -144,7 +144,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 200);
|
assert.strictEqual(res.status, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('文字数オーバーで怒られる', async () => {
|
test('文字数オーバーで怒られる', async () => {
|
||||||
const post = {
|
const post = {
|
||||||
text: '!'.repeat(3001),
|
text: '!'.repeat(3001),
|
||||||
};
|
};
|
||||||
|
@ -152,7 +152,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('存在しないリプライ先で怒られる', async () => {
|
test('存在しないリプライ先で怒られる', async () => {
|
||||||
const post = {
|
const post = {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
replyId: '000000000000000000000000',
|
replyId: '000000000000000000000000',
|
||||||
|
@ -161,7 +161,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('存在しないrenote対象で怒られる', async () => {
|
test('存在しないrenote対象で怒られる', async () => {
|
||||||
const post = {
|
const post = {
|
||||||
renoteId: '000000000000000000000000',
|
renoteId: '000000000000000000000000',
|
||||||
};
|
};
|
||||||
|
@ -169,7 +169,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('不正なリプライ先IDで怒られる', async () => {
|
test('不正なリプライ先IDで怒られる', async () => {
|
||||||
const post = {
|
const post = {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
replyId: 'foo',
|
replyId: 'foo',
|
||||||
|
@ -178,7 +178,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('不正なrenote対象IDで怒られる', async () => {
|
test('不正なrenote対象IDで怒られる', async () => {
|
||||||
const post = {
|
const post = {
|
||||||
renoteId: 'foo',
|
renoteId: 'foo',
|
||||||
};
|
};
|
||||||
|
@ -186,7 +186,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('存在しないユーザーにメンションできる', async () => {
|
test('存在しないユーザーにメンションできる', async () => {
|
||||||
const post = {
|
const post = {
|
||||||
text: '@ghost yo',
|
text: '@ghost yo',
|
||||||
};
|
};
|
||||||
|
@ -198,7 +198,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.body.createdNote.text, post.text);
|
assert.strictEqual(res.body.createdNote.text, post.text);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('同じユーザーに複数メンションしても内部的にまとめられる', async () => {
|
test('同じユーザーに複数メンションしても内部的にまとめられる', async () => {
|
||||||
const post = {
|
const post = {
|
||||||
text: '@bob @bob @bob yo',
|
text: '@bob @bob @bob yo',
|
||||||
};
|
};
|
||||||
|
@ -214,7 +214,7 @@ describe('Note', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('notes/create', () => {
|
describe('notes/create', () => {
|
||||||
it('投票を添付できる', async () => {
|
test('投票を添付できる', async () => {
|
||||||
const res = await request('/notes/create', {
|
const res = await request('/notes/create', {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
poll: {
|
poll: {
|
||||||
|
@ -227,14 +227,14 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.body.createdNote.poll != null, true);
|
assert.strictEqual(res.body.createdNote.poll != null, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('投票の選択肢が無くて怒られる', async () => {
|
test('投票の選択肢が無くて怒られる', async () => {
|
||||||
const res = await request('/notes/create', {
|
const res = await request('/notes/create', {
|
||||||
poll: {},
|
poll: {},
|
||||||
}, alice);
|
}, alice);
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('投票の選択肢が無くて怒られる (空の配列)', async () => {
|
test('投票の選択肢が無くて怒られる (空の配列)', async () => {
|
||||||
const res = await request('/notes/create', {
|
const res = await request('/notes/create', {
|
||||||
poll: {
|
poll: {
|
||||||
choices: [],
|
choices: [],
|
||||||
|
@ -243,7 +243,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('投票の選択肢が1つで怒られる', async () => {
|
test('投票の選択肢が1つで怒られる', async () => {
|
||||||
const res = await request('/notes/create', {
|
const res = await request('/notes/create', {
|
||||||
poll: {
|
poll: {
|
||||||
choices: ['Strawberry Pasta'],
|
choices: ['Strawberry Pasta'],
|
||||||
|
@ -252,7 +252,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('投票できる', async () => {
|
test('投票できる', async () => {
|
||||||
const { body } = await request('/notes/create', {
|
const { body } = await request('/notes/create', {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
poll: {
|
poll: {
|
||||||
|
@ -268,7 +268,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 204);
|
assert.strictEqual(res.status, 204);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('複数投票できない', async () => {
|
test('複数投票できない', async () => {
|
||||||
const { body } = await request('/notes/create', {
|
const { body } = await request('/notes/create', {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
poll: {
|
poll: {
|
||||||
|
@ -289,7 +289,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 400);
|
assert.strictEqual(res.status, 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('許可されている場合は複数投票できる', async () => {
|
test('許可されている場合は複数投票できる', async () => {
|
||||||
const { body } = await request('/notes/create', {
|
const { body } = await request('/notes/create', {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
poll: {
|
poll: {
|
||||||
|
@ -316,7 +316,7 @@ describe('Note', () => {
|
||||||
assert.strictEqual(res.status, 204);
|
assert.strictEqual(res.status, 204);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('締め切られている場合は投票できない', async () => {
|
test('締め切られている場合は投票できない', async () => {
|
||||||
const { body } = await request('/notes/create', {
|
const { body } = await request('/notes/create', {
|
||||||
text: 'test',
|
text: 'test',
|
||||||
poll: {
|
poll: {
|
||||||
|
@ -337,7 +337,7 @@ describe('Note', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('notes/delete', () => {
|
describe('notes/delete', () => {
|
||||||
it('delete a reply', async () => {
|
test('delete a reply', async () => {
|
||||||
const mainNoteRes = await api('notes/create', {
|
const mainNoteRes = await api('notes/create', {
|
||||||
text: 'main post',
|
text: 'main post',
|
||||||
}, alice);
|
}, alice);
|
||||||
|
|
|
@ -78,7 +78,7 @@ describe('Streaming', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Events', () => {
|
describe('Events', () => {
|
||||||
it('mention event', async () => {
|
test('mention event', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
kyoko, 'main', // kyoko:main
|
kyoko, 'main', // kyoko:main
|
||||||
() => post(ayano, { text: 'foo @kyoko bar' }), // ayano mention => kyoko
|
() => post(ayano, { text: 'foo @kyoko bar' }), // ayano mention => kyoko
|
||||||
|
@ -88,7 +88,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renote event', async () => {
|
test('renote event', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
kyoko, 'main', // kyoko:main
|
kyoko, 'main', // kyoko:main
|
||||||
() => post(ayano, { renoteId: kyokoNote.id }), // ayano renote
|
() => post(ayano, { renoteId: kyokoNote.id }), // ayano renote
|
||||||
|
@ -100,7 +100,7 @@ describe('Streaming', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Home Timeline', () => {
|
describe('Home Timeline', () => {
|
||||||
it('自分の投稿が流れる', async () => {
|
test('自分の投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'homeTimeline', // ayano:Home
|
ayano, 'homeTimeline', // ayano:Home
|
||||||
() => api('notes/create', { text: 'foo' }, ayano), // ayano posts
|
() => api('notes/create', { text: 'foo' }, ayano), // ayano posts
|
||||||
|
@ -110,7 +110,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしているユーザーの投稿が流れる', async () => {
|
test('フォローしているユーザーの投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'homeTimeline', // ayano:home
|
ayano, 'homeTimeline', // ayano:home
|
||||||
() => api('notes/create', { text: 'foo' }, kyoko), // kyoko posts
|
() => api('notes/create', { text: 'foo' }, kyoko), // kyoko posts
|
||||||
|
@ -120,7 +120,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしていないユーザーの投稿は流れない', async () => {
|
test('フォローしていないユーザーの投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
kyoko, 'homeTimeline', // kyoko:home
|
kyoko, 'homeTimeline', // kyoko:home
|
||||||
() => api('notes/create', { text: 'foo' }, ayano), // ayano posts
|
() => api('notes/create', { text: 'foo' }, ayano), // ayano posts
|
||||||
|
@ -130,7 +130,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, false);
|
assert.strictEqual(fired, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしているユーザーのダイレクト投稿が流れる', async () => {
|
test('フォローしているユーザーのダイレクト投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'homeTimeline', // ayano:home
|
ayano, 'homeTimeline', // ayano:home
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko), // kyoko dm => ayano
|
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko), // kyoko dm => ayano
|
||||||
|
@ -140,7 +140,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしているユーザーでも自分が指定されていないダイレクト投稿は流れない', async () => {
|
test('フォローしているユーザーでも自分が指定されていないダイレクト投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'homeTimeline', // ayano:home
|
ayano, 'homeTimeline', // ayano:home
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [chitose.id] }, kyoko), // kyoko dm => chitose
|
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [chitose.id] }, kyoko), // kyoko dm => chitose
|
||||||
|
@ -152,7 +152,7 @@ describe('Streaming', () => {
|
||||||
}); // Home
|
}); // Home
|
||||||
|
|
||||||
describe('Local Timeline', () => {
|
describe('Local Timeline', () => {
|
||||||
it('自分の投稿が流れる', async () => {
|
test('自分の投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'localTimeline', // ayano:Local
|
ayano, 'localTimeline', // ayano:Local
|
||||||
() => api('notes/create', { text: 'foo' }, ayano), // ayano posts
|
() => api('notes/create', { text: 'foo' }, ayano), // ayano posts
|
||||||
|
@ -162,7 +162,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしていないローカルユーザーの投稿が流れる', async () => {
|
test('フォローしていないローカルユーザーの投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'localTimeline', // ayano:Local
|
ayano, 'localTimeline', // ayano:Local
|
||||||
() => api('notes/create', { text: 'foo' }, chitose), // chitose posts
|
() => api('notes/create', { text: 'foo' }, chitose), // chitose posts
|
||||||
|
@ -172,7 +172,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('リモートユーザーの投稿は流れない', async () => {
|
test('リモートユーザーの投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'localTimeline', // ayano:Local
|
ayano, 'localTimeline', // ayano:Local
|
||||||
() => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts
|
() => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts
|
||||||
|
@ -182,7 +182,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, false);
|
assert.strictEqual(fired, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしてたとしてもリモートユーザーの投稿は流れない', async () => {
|
test('フォローしてたとしてもリモートユーザーの投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'localTimeline', // ayano:Local
|
ayano, 'localTimeline', // ayano:Local
|
||||||
() => api('notes/create', { text: 'foo' }, akari), // akari posts
|
() => api('notes/create', { text: 'foo' }, akari), // akari posts
|
||||||
|
@ -192,7 +192,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, false);
|
assert.strictEqual(fired, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ホーム指定の投稿は流れない', async () => {
|
test('ホーム指定の投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'localTimeline', // ayano:Local
|
ayano, 'localTimeline', // ayano:Local
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko), // kyoko home posts
|
() => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko), // kyoko home posts
|
||||||
|
@ -202,7 +202,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, false);
|
assert.strictEqual(fired, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしているローカルユーザーのダイレクト投稿は流れない', async () => {
|
test('フォローしているローカルユーザーのダイレクト投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'localTimeline', // ayano:Local
|
ayano, 'localTimeline', // ayano:Local
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko), // kyoko DM => ayano
|
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko), // kyoko DM => ayano
|
||||||
|
@ -212,7 +212,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, false);
|
assert.strictEqual(fired, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', async () => {
|
test('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'localTimeline', // ayano:Local
|
ayano, 'localTimeline', // ayano:Local
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'followers' }, chitose),
|
() => api('notes/create', { text: 'foo', visibility: 'followers' }, chitose),
|
||||||
|
@ -224,7 +224,7 @@ describe('Streaming', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Hybrid Timeline', () => {
|
describe('Hybrid Timeline', () => {
|
||||||
it('自分の投稿が流れる', async () => {
|
test('自分の投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'hybridTimeline', // ayano:Hybrid
|
ayano, 'hybridTimeline', // ayano:Hybrid
|
||||||
() => api('notes/create', { text: 'foo' }, ayano), // ayano posts
|
() => api('notes/create', { text: 'foo' }, ayano), // ayano posts
|
||||||
|
@ -234,7 +234,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしていないローカルユーザーの投稿が流れる', async () => {
|
test('フォローしていないローカルユーザーの投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'hybridTimeline', // ayano:Hybrid
|
ayano, 'hybridTimeline', // ayano:Hybrid
|
||||||
() => api('notes/create', { text: 'foo' }, chitose), // chitose posts
|
() => api('notes/create', { text: 'foo' }, chitose), // chitose posts
|
||||||
|
@ -244,7 +244,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしているリモートユーザーの投稿が流れる', async () => {
|
test('フォローしているリモートユーザーの投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'hybridTimeline', // ayano:Hybrid
|
ayano, 'hybridTimeline', // ayano:Hybrid
|
||||||
() => api('notes/create', { text: 'foo' }, akari), // akari posts
|
() => api('notes/create', { text: 'foo' }, akari), // akari posts
|
||||||
|
@ -254,7 +254,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしていないリモートユーザーの投稿は流れない', async () => {
|
test('フォローしていないリモートユーザーの投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'hybridTimeline', // ayano:Hybrid
|
ayano, 'hybridTimeline', // ayano:Hybrid
|
||||||
() => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts
|
() => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts
|
||||||
|
@ -264,7 +264,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, false);
|
assert.strictEqual(fired, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしているユーザーのダイレクト投稿が流れる', async () => {
|
test('フォローしているユーザーのダイレクト投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'hybridTimeline', // ayano:Hybrid
|
ayano, 'hybridTimeline', // ayano:Hybrid
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko),
|
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [ayano.id] }, kyoko),
|
||||||
|
@ -274,7 +274,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしているユーザーのホーム投稿が流れる', async () => {
|
test('フォローしているユーザーのホーム投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'hybridTimeline', // ayano:Hybrid
|
ayano, 'hybridTimeline', // ayano:Hybrid
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko),
|
() => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko),
|
||||||
|
@ -284,7 +284,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしていないローカルユーザーのホーム投稿は流れない', async () => {
|
test('フォローしていないローカルユーザーのホーム投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'hybridTimeline', // ayano:Hybrid
|
ayano, 'hybridTimeline', // ayano:Hybrid
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'home' }, chitose),
|
() => api('notes/create', { text: 'foo', visibility: 'home' }, chitose),
|
||||||
|
@ -294,7 +294,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, false);
|
assert.strictEqual(fired, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', async () => {
|
test('フォローしていないローカルユーザーのフォロワー宛て投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'hybridTimeline', // ayano:Hybrid
|
ayano, 'hybridTimeline', // ayano:Hybrid
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'followers' }, chitose),
|
() => api('notes/create', { text: 'foo', visibility: 'followers' }, chitose),
|
||||||
|
@ -306,7 +306,7 @@ describe('Streaming', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Global Timeline', () => {
|
describe('Global Timeline', () => {
|
||||||
it('フォローしていないローカルユーザーの投稿が流れる', async () => {
|
test('フォローしていないローカルユーザーの投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'globalTimeline', // ayano:Global
|
ayano, 'globalTimeline', // ayano:Global
|
||||||
() => api('notes/create', { text: 'foo' }, chitose), // chitose posts
|
() => api('notes/create', { text: 'foo' }, chitose), // chitose posts
|
||||||
|
@ -316,7 +316,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('フォローしていないリモートユーザーの投稿が流れる', async () => {
|
test('フォローしていないリモートユーザーの投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'globalTimeline', // ayano:Global
|
ayano, 'globalTimeline', // ayano:Global
|
||||||
() => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts
|
() => api('notes/create', { text: 'foo' }, chinatsu), // chinatsu posts
|
||||||
|
@ -326,7 +326,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ホーム投稿は流れない', async () => {
|
test('ホーム投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
ayano, 'globalTimeline', // ayano:Global
|
ayano, 'globalTimeline', // ayano:Global
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko), // kyoko posts
|
() => api('notes/create', { text: 'foo', visibility: 'home' }, kyoko), // kyoko posts
|
||||||
|
@ -338,7 +338,7 @@ describe('Streaming', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('UserList Timeline', () => {
|
describe('UserList Timeline', () => {
|
||||||
it('リストに入れているユーザーの投稿が流れる', async () => {
|
test('リストに入れているユーザーの投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
chitose, 'userList',
|
chitose, 'userList',
|
||||||
() => api('notes/create', { text: 'foo' }, ayano),
|
() => api('notes/create', { text: 'foo' }, ayano),
|
||||||
|
@ -349,7 +349,7 @@ describe('Streaming', () => {
|
||||||
assert.strictEqual(fired, true);
|
assert.strictEqual(fired, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('リストに入れていないユーザーの投稿は流れない', async () => {
|
test('リストに入れていないユーザーの投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
chitose, 'userList',
|
chitose, 'userList',
|
||||||
() => api('notes/create', { text: 'foo' }, chinatsu),
|
() => api('notes/create', { text: 'foo' }, chinatsu),
|
||||||
|
@ -361,7 +361,7 @@ describe('Streaming', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// #4471
|
// #4471
|
||||||
it('リストに入れているユーザーのダイレクト投稿が流れる', async () => {
|
test('リストに入れているユーザーのダイレクト投稿が流れる', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
chitose, 'userList',
|
chitose, 'userList',
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [chitose.id] }, ayano),
|
() => api('notes/create', { text: 'foo', visibility: 'specified', visibleUserIds: [chitose.id] }, ayano),
|
||||||
|
@ -373,7 +373,7 @@ describe('Streaming', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// #4335
|
// #4335
|
||||||
it('リストに入れているがフォローはしてないユーザーのフォロワー宛て投稿は流れない', async () => {
|
test('リストに入れているがフォローはしてないユーザーのフォロワー宛て投稿は流れない', async () => {
|
||||||
const fired = await waitFire(
|
const fired = await waitFire(
|
||||||
chitose, 'userList',
|
chitose, 'userList',
|
||||||
() => api('notes/create', { text: 'foo', visibility: 'followers' }, kyoko),
|
() => api('notes/create', { text: 'foo', visibility: 'followers' }, kyoko),
|
||||||
|
@ -386,7 +386,7 @@ describe('Streaming', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Hashtag Timeline', () => {
|
describe('Hashtag Timeline', () => {
|
||||||
it('指定したハッシュタグの投稿が流れる', () => new Promise<void>(async done => {
|
test('指定したハッシュタグの投稿が流れる', () => new Promise<void>(async done => {
|
||||||
const ws = await connectStream(chitose, 'hashtag', ({ type, body }) => {
|
const ws = await connectStream(chitose, 'hashtag', ({ type, body }) => {
|
||||||
if (type === 'note') {
|
if (type === 'note') {
|
||||||
assert.deepStrictEqual(body.text, '#foo');
|
assert.deepStrictEqual(body.text, '#foo');
|
||||||
|
@ -404,7 +404,7 @@ describe('Streaming', () => {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('指定したハッシュタグの投稿が流れる (AND)', () => new Promise<void>(async done => {
|
test('指定したハッシュタグの投稿が流れる (AND)', () => new Promise<void>(async done => {
|
||||||
let fooCount = 0;
|
let fooCount = 0;
|
||||||
let barCount = 0;
|
let barCount = 0;
|
||||||
let fooBarCount = 0;
|
let fooBarCount = 0;
|
||||||
|
@ -442,7 +442,7 @@ describe('Streaming', () => {
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('指定したハッシュタグの投稿が流れる (OR)', () => new Promise<void>(async done => {
|
test('指定したハッシュタグの投稿が流れる (OR)', () => new Promise<void>(async done => {
|
||||||
let fooCount = 0;
|
let fooCount = 0;
|
||||||
let barCount = 0;
|
let barCount = 0;
|
||||||
let fooBarCount = 0;
|
let fooBarCount = 0;
|
||||||
|
@ -488,7 +488,7 @@ describe('Streaming', () => {
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('指定したハッシュタグの投稿が流れる (AND + OR)', () => new Promise<void>(async done => {
|
test('指定したハッシュタグの投稿が流れる (AND + OR)', () => new Promise<void>(async done => {
|
||||||
let fooCount = 0;
|
let fooCount = 0;
|
||||||
let barCount = 0;
|
let barCount = 0;
|
||||||
let fooBarCount = 0;
|
let fooBarCount = 0;
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe('Note thread mute', () => {
|
||||||
await shutdownServer(p);
|
await shutdownServer(p);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('notes/mentions にミュートしているスレッドの投稿が含まれない', async () => {
|
test('notes/mentions にミュートしているスレッドの投稿が含まれない', async () => {
|
||||||
const bobNote = await post(bob, { text: '@alice @carol root note' });
|
const bobNote = await post(bob, { text: '@alice @carol root note' });
|
||||||
const aliceReply = await post(alice, { replyId: bobNote.id, text: '@bob @carol child note' });
|
const aliceReply = await post(alice, { replyId: bobNote.id, text: '@bob @carol child note' });
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ describe('Note thread mute', () => {
|
||||||
assert.strictEqual(res.body.some((note: any) => note.id === carolReplyWithoutMention.id), false);
|
assert.strictEqual(res.body.some((note: any) => note.id === carolReplyWithoutMention.id), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ミュートしているスレッドからメンションされても、hasUnreadMentions が true にならない', async () => {
|
test('ミュートしているスレッドからメンションされても、hasUnreadMentions が true にならない', async () => {
|
||||||
// 状態リセット
|
// 状態リセット
|
||||||
await request('/i/read-all-unread-notes', {}, alice);
|
await request('/i/read-all-unread-notes', {}, alice);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ describe('Note thread mute', () => {
|
||||||
assert.strictEqual(res.body.hasUnreadMentions, false);
|
assert.strictEqual(res.body.hasUnreadMentions, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ミュートしているスレッドからメンションされても、ストリームに unreadMention イベントが流れてこない', () => new Promise(async done => {
|
test('ミュートしているスレッドからメンションされても、ストリームに unreadMention イベントが流れてこない', () => new Promise(async done => {
|
||||||
// 状態リセット
|
// 状態リセット
|
||||||
await request('/i/read-all-unread-notes', {}, alice);
|
await request('/i/read-all-unread-notes', {}, alice);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ describe('Note thread mute', () => {
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('i/notifications にミュートしているスレッドの通知が含まれない', async () => {
|
test('i/notifications にミュートしているスレッドの通知が含まれない', async () => {
|
||||||
const bobNote = await post(bob, { text: '@alice @carol root note' });
|
const bobNote = await post(bob, { text: '@alice @carol root note' });
|
||||||
const aliceReply = await post(alice, { replyId: bobNote.id, text: '@bob @carol child note' });
|
const aliceReply = await post(alice, { replyId: bobNote.id, text: '@bob @carol child note' });
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ describe('users/notes', () => {
|
||||||
await shutdownServer(p);
|
await shutdownServer(p);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ファイルタイプ指定 (jpg)', async () => {
|
test('ファイルタイプ指定 (jpg)', async () => {
|
||||||
const res = await request('/users/notes', {
|
const res = await request('/users/notes', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
fileType: ['image/jpeg'],
|
fileType: ['image/jpeg'],
|
||||||
|
@ -45,7 +45,7 @@ describe('users/notes', () => {
|
||||||
assert.strictEqual(res.body.some((note: any) => note.id === jpgPngNote.id), true);
|
assert.strictEqual(res.body.some((note: any) => note.id === jpgPngNote.id), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ファイルタイプ指定 (jpg or png)', async () => {
|
test('ファイルタイプ指定 (jpg or png)', async () => {
|
||||||
const res = await request('/users/notes', {
|
const res = await request('/users/notes', {
|
||||||
userId: alice.id,
|
userId: alice.id,
|
||||||
fileType: ['image/jpeg', 'image/png'],
|
fileType: ['image/jpeg', 'image/png'],
|
||||||
|
|
|
@ -2,17 +2,17 @@ import * as assert from 'assert';
|
||||||
import { just, nothing } from '../../src/misc/prelude/maybe.js';
|
import { just, nothing } from '../../src/misc/prelude/maybe.js';
|
||||||
|
|
||||||
describe('just', () => {
|
describe('just', () => {
|
||||||
it('has a value', () => {
|
test('has a value', () => {
|
||||||
assert.deepStrictEqual(just(3).isJust(), true);
|
assert.deepStrictEqual(just(3).isJust(), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has the inverse called get', () => {
|
test('has the inverse called get', () => {
|
||||||
assert.deepStrictEqual(just(3).get(), 3);
|
assert.deepStrictEqual(just(3).get(), 3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('nothing', () => {
|
describe('nothing', () => {
|
||||||
it('has no value', () => {
|
test('has no value', () => {
|
||||||
assert.deepStrictEqual(nothing().isJust(), false);
|
assert.deepStrictEqual(nothing().isJust(), false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as assert from 'assert';
|
||||||
import { query } from '../../src/misc/prelude/url.js';
|
import { query } from '../../src/misc/prelude/url.js';
|
||||||
|
|
||||||
describe('url', () => {
|
describe('url', () => {
|
||||||
it('query', () => {
|
test('query', () => {
|
||||||
const s = query({
|
const s = query({
|
||||||
foo: 'ふぅ',
|
foo: 'ふぅ',
|
||||||
bar: 'b a r',
|
bar: 'b a r',
|
||||||
|
|
|
@ -27,7 +27,7 @@ describe('ActivityPub', () => {
|
||||||
content: 'あ',
|
content: 'あ',
|
||||||
};
|
};
|
||||||
|
|
||||||
it('Minimum Actor', async () => {
|
test('Minimum Actor', async () => {
|
||||||
const { MockResolver } = await import('../misc/mock-resolver.js');
|
const { MockResolver } = await import('../misc/mock-resolver.js');
|
||||||
const { createPerson } = await import('../../src/activitypub/models/person.js');
|
const { createPerson } = await import('../../src/activitypub/models/person.js');
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ describe('ActivityPub', () => {
|
||||||
assert.deepStrictEqual(user.inbox, actor.inbox);
|
assert.deepStrictEqual(user.inbox, actor.inbox);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Minimum Note', async () => {
|
test('Minimum Note', async () => {
|
||||||
const { MockResolver } = await import('../misc/mock-resolver.js');
|
const { MockResolver } = await import('../misc/mock-resolver.js');
|
||||||
const { createNote } = await import('../../src/activitypub/models/note.js');
|
const { createNote } = await import('../../src/activitypub/models/note.js');
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ describe('ActivityPub', () => {
|
||||||
outbox: `${actorId}/outbox`,
|
outbox: `${actorId}/outbox`,
|
||||||
};
|
};
|
||||||
|
|
||||||
it('Actor', async () => {
|
test('Actor', async () => {
|
||||||
const { MockResolver } = await import('../misc/mock-resolver.js');
|
const { MockResolver } = await import('../misc/mock-resolver.js');
|
||||||
const { createPerson } = await import('../../src/activitypub/models/person.js');
|
const { createPerson } = await import('../../src/activitypub/models/person.js');
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ export const buildParsedSignature = (signingString: string, signature: string, a
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('ap-request', () => {
|
describe('ap-request', () => {
|
||||||
it('createSignedPost with verify', async () => {
|
test('createSignedPost with verify', async () => {
|
||||||
const keypair = await genRsaKeyPair();
|
const keypair = await genRsaKeyPair();
|
||||||
const key = { keyId: 'x', 'privateKeyPem': keypair.privateKey };
|
const key = { keyId: 'x', 'privateKeyPem': keypair.privateKey };
|
||||||
const url = 'https://example.com/inbox';
|
const url = 'https://example.com/inbox';
|
||||||
|
@ -37,7 +37,7 @@ describe('ap-request', () => {
|
||||||
assert.deepStrictEqual(result, true);
|
assert.deepStrictEqual(result, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('createSignedGet with verify', async () => {
|
test('createSignedGet with verify', async () => {
|
||||||
const keypair = await genRsaKeyPair();
|
const keypair = await genRsaKeyPair();
|
||||||
const key = { keyId: 'x', 'privateKeyPem': keypair.privateKey };
|
const key = { keyId: 'x', 'privateKeyPem': keypair.privateKey };
|
||||||
const url = 'https://example.com/outbox';
|
const url = 'https://example.com/outbox';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { parse } from 'mfm-js';
|
||||||
import { extractMentions } from '../../src/misc/extract-mentions.js';
|
import { extractMentions } from '../../src/misc/extract-mentions.js';
|
||||||
|
|
||||||
describe('Extract mentions', () => {
|
describe('Extract mentions', () => {
|
||||||
it('simple', () => {
|
test('simple', () => {
|
||||||
const ast = parse('@foo @bar @baz')!;
|
const ast = parse('@foo @bar @baz')!;
|
||||||
const mentions = extractMentions(ast);
|
const mentions = extractMentions(ast);
|
||||||
assert.deepStrictEqual(mentions, [{
|
assert.deepStrictEqual(mentions, [{
|
||||||
|
@ -22,7 +22,7 @@ describe('Extract mentions', () => {
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('nested', () => {
|
test('nested', () => {
|
||||||
const ast = parse('@foo **@bar** @baz')!;
|
const ast = parse('@foo **@bar** @baz')!;
|
||||||
const mentions = extractMentions(ast);
|
const mentions = extractMentions(ast);
|
||||||
assert.deepStrictEqual(mentions, [{
|
assert.deepStrictEqual(mentions, [{
|
||||||
|
|
|
@ -5,13 +5,13 @@ import { toHtml } from '../../src/mfm/to-html.js';
|
||||||
import { fromHtml } from '../../src/mfm/from-html.js';
|
import { fromHtml } from '../../src/mfm/from-html.js';
|
||||||
|
|
||||||
describe('toHtml', () => {
|
describe('toHtml', () => {
|
||||||
it('br', () => {
|
test('br', () => {
|
||||||
const input = 'foo\nbar\nbaz';
|
const input = 'foo\nbar\nbaz';
|
||||||
const output = '<p><span>foo<br>bar<br>baz</span></p>';
|
const output = '<p><span>foo<br>bar<br>baz</span></p>';
|
||||||
assert.equal(toHtml(mfm.parse(input)), output);
|
assert.equal(toHtml(mfm.parse(input)), output);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('br alt', () => {
|
test('br alt', () => {
|
||||||
const input = 'foo\r\nbar\rbaz';
|
const input = 'foo\r\nbar\rbaz';
|
||||||
const output = '<p><span>foo<br>bar<br>baz</span></p>';
|
const output = '<p><span>foo<br>bar<br>baz</span></p>';
|
||||||
assert.equal(toHtml(mfm.parse(input)), output);
|
assert.equal(toHtml(mfm.parse(input)), output);
|
||||||
|
@ -19,71 +19,71 @@ describe('toHtml', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('fromHtml', () => {
|
describe('fromHtml', () => {
|
||||||
it('p', () => {
|
test('p', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a</p><p>b</p>'), 'a\n\nb');
|
assert.deepStrictEqual(fromHtml('<p>a</p><p>b</p>'), 'a\n\nb');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('block element', () => {
|
test('block element', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<div>a</div><div>b</div>'), 'a\nb');
|
assert.deepStrictEqual(fromHtml('<div>a</div><div>b</div>'), 'a\nb');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('inline element', () => {
|
test('inline element', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<ul><li>a</li><li>b</li></ul>'), 'a\nb');
|
assert.deepStrictEqual(fromHtml('<ul><li>a</li><li>b</li></ul>'), 'a\nb');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('block code', () => {
|
test('block code', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<pre><code>a\nb</code></pre>'), '```\na\nb\n```');
|
assert.deepStrictEqual(fromHtml('<pre><code>a\nb</code></pre>'), '```\na\nb\n```');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('inline code', () => {
|
test('inline code', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<code>a</code>'), '`a`');
|
assert.deepStrictEqual(fromHtml('<code>a</code>'), '`a`');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('quote', () => {
|
test('quote', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<blockquote>a\nb</blockquote>'), '> a\n> b');
|
assert.deepStrictEqual(fromHtml('<blockquote>a\nb</blockquote>'), '> a\n> b');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('br', () => {
|
test('br', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>abc<br><br/>d</p>'), 'abc\n\nd');
|
assert.deepStrictEqual(fromHtml('<p>abc<br><br/>d</p>'), 'abc\n\nd');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('link with different text', () => {
|
test('link with different text', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/b">c</a> d</p>'), 'a [c](https://example.com/b) d');
|
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/b">c</a> d</p>'), 'a [c](https://example.com/b) d');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('link with different text, but not encoded', () => {
|
test('link with different text, but not encoded', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/ä">c</a> d</p>'), 'a [c](<https://example.com/ä>) d');
|
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/ä">c</a> d</p>'), 'a [c](<https://example.com/ä>) d');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('link with same text', () => {
|
test('link with same text', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/b">https://example.com/b</a> d</p>'), 'a https://example.com/b d');
|
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/b">https://example.com/b</a> d</p>'), 'a https://example.com/b d');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('link with same text, but not encoded', () => {
|
test('link with same text, but not encoded', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/ä">https://example.com/ä</a> d</p>'), 'a <https://example.com/ä> d');
|
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/ä">https://example.com/ä</a> d</p>'), 'a <https://example.com/ä> d');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('link with no url', () => {
|
test('link with no url', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a href="b">c</a> d</p>'), 'a [c](b) d');
|
assert.deepStrictEqual(fromHtml('<p>a <a href="b">c</a> d</p>'), 'a [c](b) d');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('link without href', () => {
|
test('link without href', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a>c</a> d</p>'), 'a c d');
|
assert.deepStrictEqual(fromHtml('<p>a <a>c</a> d</p>'), 'a c d');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('link without text', () => {
|
test('link without text', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/b"></a> d</p>'), 'a https://example.com/b d');
|
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/b"></a> d</p>'), 'a https://example.com/b d');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('link without both', () => {
|
test('link without both', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a></a> d</p>'), 'a d');
|
assert.deepStrictEqual(fromHtml('<p>a <a></a> d</p>'), 'a d');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('mention', () => {
|
test('mention', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/@user" class="u-url mention">@user</a> d</p>'), 'a @user@example.com d');
|
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/@user" class="u-url mention">@user</a> d</p>'), 'a @user@example.com d');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('hashtag', () => {
|
test('hashtag', () => {
|
||||||
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/tags/a">#a</a> d</p>', ['#a']), 'a #a d');
|
assert.deepStrictEqual(fromHtml('<p>a <a href="https://example.com/tags/a">#a</a> d</p>', ['#a']), 'a #a d');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,79 +4,79 @@ import * as assert from 'assert';
|
||||||
import { toDbReaction } from '../src/misc/reaction-lib.js';
|
import { toDbReaction } from '../src/misc/reaction-lib.js';
|
||||||
|
|
||||||
describe('toDbReaction', async () => {
|
describe('toDbReaction', async () => {
|
||||||
it('既存の文字列リアクションはそのまま', async () => {
|
test('既存の文字列リアクションはそのまま', async () => {
|
||||||
assert.strictEqual(await toDbReaction('like'), 'like');
|
assert.strictEqual(await toDbReaction('like'), 'like');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Unicodeプリンは寿司化不能とするため文字列化しない', async () => {
|
test('Unicodeプリンは寿司化不能とするため文字列化しない', async () => {
|
||||||
assert.strictEqual(await toDbReaction('🍮'), '🍮');
|
assert.strictEqual(await toDbReaction('🍮'), '🍮');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する like', async () => {
|
test('プリン以外の既存のリアクションは文字列化する like', async () => {
|
||||||
assert.strictEqual(await toDbReaction('👍'), 'like');
|
assert.strictEqual(await toDbReaction('👍'), 'like');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する love', async () => {
|
test('プリン以外の既存のリアクションは文字列化する love', async () => {
|
||||||
assert.strictEqual(await toDbReaction('❤️'), 'love');
|
assert.strictEqual(await toDbReaction('❤️'), 'love');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する love 異体字セレクタなし', async () => {
|
test('プリン以外の既存のリアクションは文字列化する love 異体字セレクタなし', async () => {
|
||||||
assert.strictEqual(await toDbReaction('❤'), 'love');
|
assert.strictEqual(await toDbReaction('❤'), 'love');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する laugh', async () => {
|
test('プリン以外の既存のリアクションは文字列化する laugh', async () => {
|
||||||
assert.strictEqual(await toDbReaction('😆'), 'laugh');
|
assert.strictEqual(await toDbReaction('😆'), 'laugh');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する hmm', async () => {
|
test('プリン以外の既存のリアクションは文字列化する hmm', async () => {
|
||||||
assert.strictEqual(await toDbReaction('🤔'), 'hmm');
|
assert.strictEqual(await toDbReaction('🤔'), 'hmm');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する surprise', async () => {
|
test('プリン以外の既存のリアクションは文字列化する surprise', async () => {
|
||||||
assert.strictEqual(await toDbReaction('😮'), 'surprise');
|
assert.strictEqual(await toDbReaction('😮'), 'surprise');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する congrats', async () => {
|
test('プリン以外の既存のリアクションは文字列化する congrats', async () => {
|
||||||
assert.strictEqual(await toDbReaction('🎉'), 'congrats');
|
assert.strictEqual(await toDbReaction('🎉'), 'congrats');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する angry', async () => {
|
test('プリン以外の既存のリアクションは文字列化する angry', async () => {
|
||||||
assert.strictEqual(await toDbReaction('💢'), 'angry');
|
assert.strictEqual(await toDbReaction('💢'), 'angry');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する confused', async () => {
|
test('プリン以外の既存のリアクションは文字列化する confused', async () => {
|
||||||
assert.strictEqual(await toDbReaction('😥'), 'confused');
|
assert.strictEqual(await toDbReaction('😥'), 'confused');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('プリン以外の既存のリアクションは文字列化する rip', async () => {
|
test('プリン以外の既存のリアクションは文字列化する rip', async () => {
|
||||||
assert.strictEqual(await toDbReaction('😇'), 'rip');
|
assert.strictEqual(await toDbReaction('😇'), 'rip');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('それ以外はUnicodeのまま', async () => {
|
test('それ以外はUnicodeのまま', async () => {
|
||||||
assert.strictEqual(await toDbReaction('🍅'), '🍅');
|
assert.strictEqual(await toDbReaction('🍅'), '🍅');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('異体字セレクタ除去', async () => {
|
test('異体字セレクタ除去', async () => {
|
||||||
assert.strictEqual(await toDbReaction('㊗️'), '㊗');
|
assert.strictEqual(await toDbReaction('㊗️'), '㊗');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('異体字セレクタ除去 必要なし', async () => {
|
test('異体字セレクタ除去 必要なし', async () => {
|
||||||
assert.strictEqual(await toDbReaction('㊗'), '㊗');
|
assert.strictEqual(await toDbReaction('㊗'), '㊗');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fallback - undefined', async () => {
|
test('fallback - undefined', async () => {
|
||||||
assert.strictEqual(await toDbReaction(undefined), 'like');
|
assert.strictEqual(await toDbReaction(undefined), 'like');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fallback - null', async () => {
|
test('fallback - null', async () => {
|
||||||
assert.strictEqual(await toDbReaction(null), 'like');
|
assert.strictEqual(await toDbReaction(null), 'like');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fallback - empty', async () => {
|
test('fallback - empty', async () => {
|
||||||
assert.strictEqual(await toDbReaction(''), 'like');
|
assert.strictEqual(await toDbReaction(''), 'like');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fallback - unknown', async () => {
|
test('fallback - unknown', async () => {
|
||||||
assert.strictEqual(await toDbReaction('unknown'), 'like');
|
assert.strictEqual(await toDbReaction('unknown'), 'like');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,7 +54,7 @@ describe('FileInfoService', () => {
|
||||||
await app.close();
|
await app.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Empty file', async () => {
|
test('Empty file', async () => {
|
||||||
const path = `${resources}/emptyfile`;
|
const path = `${resources}/emptyfile`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
|
@ -74,7 +74,7 @@ describe('FileInfoService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Generic JPEG', async () => {
|
test('Generic JPEG', async () => {
|
||||||
const path = `${resources}/Lenna.jpg`;
|
const path = `${resources}/Lenna.jpg`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
|
@ -94,7 +94,7 @@ describe('FileInfoService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Generic APNG', async () => {
|
test('Generic APNG', async () => {
|
||||||
const path = `${resources}/anime.png`;
|
const path = `${resources}/anime.png`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
|
@ -114,7 +114,7 @@ describe('FileInfoService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Generic AGIF', async () => {
|
test('Generic AGIF', async () => {
|
||||||
const path = `${resources}/anime.gif`;
|
const path = `${resources}/anime.gif`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
|
@ -134,7 +134,7 @@ describe('FileInfoService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('PNG with alpha', async () => {
|
test('PNG with alpha', async () => {
|
||||||
const path = `${resources}/with-alpha.png`;
|
const path = `${resources}/with-alpha.png`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
|
@ -154,7 +154,7 @@ describe('FileInfoService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Generic SVG', async () => {
|
test('Generic SVG', async () => {
|
||||||
const path = `${resources}/image.svg`;
|
const path = `${resources}/image.svg`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
|
@ -174,7 +174,7 @@ describe('FileInfoService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('SVG with XML definition', async () => {
|
test('SVG with XML definition', async () => {
|
||||||
// https://github.com/misskey-dev/misskey/issues/4413
|
// https://github.com/misskey-dev/misskey/issues/4413
|
||||||
const path = `${resources}/with-xml-def.svg`;
|
const path = `${resources}/with-xml-def.svg`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
|
@ -195,7 +195,7 @@ describe('FileInfoService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Dimension limit', async () => {
|
test('Dimension limit', async () => {
|
||||||
const path = `${resources}/25000x25000.png`;
|
const path = `${resources}/25000x25000.png`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
|
@ -215,7 +215,7 @@ describe('FileInfoService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Rotate JPEG', async () => {
|
test('Rotate JPEG', async () => {
|
||||||
const path = `${resources}/rotate.jpg`;
|
const path = `${resources}/rotate.jpg`;
|
||||||
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
const info = await fileInfoService.getFileInfo(path, { skipSensitiveDetection: true }) as any;
|
||||||
delete info.warnings;
|
delete info.warnings;
|
||||||
|
|
|
@ -35,7 +35,7 @@ describe('MetaService', () => {
|
||||||
await app.close();
|
await app.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fetch (cache)', async () => {
|
test('fetch (cache)', async () => {
|
||||||
const db = app.get<DataSource>(DI.db);
|
const db = app.get<DataSource>(DI.db);
|
||||||
const spy = jest.spyOn(db, 'transaction');
|
const spy = jest.spyOn(db, 'transaction');
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ describe('MetaService', () => {
|
||||||
expect(spy).toHaveBeenCalledTimes(0);
|
expect(spy).toHaveBeenCalledTimes(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fetch (force)', async () => {
|
test('fetch (force)', async () => {
|
||||||
const db = app.get<DataSource>(DI.db);
|
const db = app.get<DataSource>(DI.db);
|
||||||
const spy = jest.spyOn(db, 'transaction');
|
const spy = jest.spyOn(db, 'transaction');
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ describe('RelayService', () => {
|
||||||
await app.close();
|
await app.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('addRelay', async () => {
|
test('addRelay', async () => {
|
||||||
const result = await relayService.addRelay('https://example.com');
|
const result = await relayService.addRelay('https://example.com');
|
||||||
|
|
||||||
expect(result.inbox).toBe('https://example.com');
|
expect(result.inbox).toBe('https://example.com');
|
||||||
|
@ -68,7 +68,7 @@ describe('RelayService', () => {
|
||||||
//expect(queueService.deliver.mock.lastCall![0].username).toBe('relay.actor');
|
//expect(queueService.deliver.mock.lastCall![0].username).toBe('relay.actor');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('listRelay', async () => {
|
test('listRelay', async () => {
|
||||||
const result = await relayService.listRelay();
|
const result = await relayService.listRelay();
|
||||||
|
|
||||||
expect(result.length).toBe(1);
|
expect(result.length).toBe(1);
|
||||||
|
@ -76,7 +76,7 @@ describe('RelayService', () => {
|
||||||
expect(result[0].status).toBe('requesting');
|
expect(result[0].status).toBe('requesting');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('removeRelay: succ', async () => {
|
test('removeRelay: succ', async () => {
|
||||||
await relayService.removeRelay('https://example.com');
|
await relayService.removeRelay('https://example.com');
|
||||||
|
|
||||||
expect(queueService.deliver).toHaveBeenCalled();
|
expect(queueService.deliver).toHaveBeenCalled();
|
||||||
|
@ -89,7 +89,7 @@ describe('RelayService', () => {
|
||||||
expect(list.length).toBe(0);
|
expect(list.length).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('removeRelay: fail', async () => {
|
test('removeRelay: fail', async () => {
|
||||||
await expect(relayService.removeRelay('https://x.example.com'))
|
await expect(relayService.removeRelay('https://x.example.com'))
|
||||||
.rejects.toThrow('relay not found');
|
.rejects.toThrow('relay not found');
|
||||||
});
|
});
|
||||||
|
|
|
@ -102,7 +102,7 @@ describe('RoleService', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getUserPolicies', () => {
|
describe('getUserPolicies', () => {
|
||||||
it('instance default policies', async () => {
|
test('instance default policies', async () => {
|
||||||
const user = await createUser();
|
const user = await createUser();
|
||||||
metaService.fetch.mockResolvedValue({
|
metaService.fetch.mockResolvedValue({
|
||||||
policies: {
|
policies: {
|
||||||
|
@ -115,7 +115,7 @@ describe('RoleService', () => {
|
||||||
expect(result.canManageCustomEmojis).toBe(false);
|
expect(result.canManageCustomEmojis).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('instance default policies 2', async () => {
|
test('instance default policies 2', async () => {
|
||||||
const user = await createUser();
|
const user = await createUser();
|
||||||
metaService.fetch.mockResolvedValue({
|
metaService.fetch.mockResolvedValue({
|
||||||
policies: {
|
policies: {
|
||||||
|
@ -128,7 +128,7 @@ describe('RoleService', () => {
|
||||||
expect(result.canManageCustomEmojis).toBe(true);
|
expect(result.canManageCustomEmojis).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('with role', async () => {
|
test('with role', async () => {
|
||||||
const user = await createUser();
|
const user = await createUser();
|
||||||
const role = await createRole({
|
const role = await createRole({
|
||||||
name: 'a',
|
name: 'a',
|
||||||
|
@ -152,7 +152,7 @@ describe('RoleService', () => {
|
||||||
expect(result.canManageCustomEmojis).toBe(true);
|
expect(result.canManageCustomEmojis).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('priority', async () => {
|
test('priority', async () => {
|
||||||
const user = await createUser();
|
const user = await createUser();
|
||||||
const role1 = await createRole({
|
const role1 = await createRole({
|
||||||
name: 'role1',
|
name: 'role1',
|
||||||
|
@ -187,7 +187,7 @@ describe('RoleService', () => {
|
||||||
expect(result.driveCapacityMb).toBe(100);
|
expect(result.driveCapacityMb).toBe(100);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('conditional role', async () => {
|
test('conditional role', async () => {
|
||||||
const user1 = await createUser({
|
const user1 = await createUser({
|
||||||
createdAt: new Date(Date.now() - (1000 * 60 * 60 * 24 * 365)),
|
createdAt: new Date(Date.now() - (1000 * 60 * 60 * 24 * 365)),
|
||||||
});
|
});
|
||||||
|
|
|
@ -78,7 +78,7 @@ describe('Chart', () => {
|
||||||
if (db) await db.destroy();
|
if (db) await db.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can updates', async () => {
|
test('Can updates', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can updates (dec)', async () => {
|
test('Can updates (dec)', async () => {
|
||||||
await testChart.decrement();
|
await testChart.decrement();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Empty chart', async () => {
|
test('Empty chart', async () => {
|
||||||
const chartHours = await testChart.getChart('hour', 3, null);
|
const chartHours = await testChart.getChart('hour', 3, null);
|
||||||
const chartDays = await testChart.getChart('day', 3, null);
|
const chartDays = await testChart.getChart('day', 3, null);
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can updates at multiple times at same time', async () => {
|
test('Can updates at multiple times at same time', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
|
@ -173,7 +173,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('複数回saveされてもデータの更新は一度だけ', async () => {
|
test('複数回saveされてもデータの更新は一度だけ', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
|
@ -199,7 +199,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can updates at different times', async () => {
|
test('Can updates at different times', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ describe('Chart', () => {
|
||||||
|
|
||||||
// 仕様上はこうなってほしいけど、実装は難しそうなのでskip
|
// 仕様上はこうなってほしいけど、実装は難しそうなのでskip
|
||||||
/*
|
/*
|
||||||
it('Can updates at different times without save', async () => {
|
test('Can updates at different times without save', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
|
|
||||||
clock.tick('01:00:00');
|
clock.tick('01:00:00');
|
||||||
|
@ -259,7 +259,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
it('Can padding', async () => {
|
test('Can padding', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// 要求された範囲にログがひとつもない場合でもパディングできる
|
// 要求された範囲にログがひとつもない場合でもパディングできる
|
||||||
it('Can padding from past range', async () => {
|
test('Can padding from past range', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ describe('Chart', () => {
|
||||||
|
|
||||||
// 要求された範囲の最も古い箇所に位置するログが存在しない場合でもパディングできる
|
// 要求された範囲の最も古い箇所に位置するログが存在しない場合でもパディングできる
|
||||||
// Issue #3190
|
// Issue #3190
|
||||||
it('Can padding from past range 2', async () => {
|
test('Can padding from past range 2', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can specify offset', async () => {
|
test('Can specify offset', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can specify offset (floor time)', async () => {
|
test('Can specify offset (floor time)', async () => {
|
||||||
clock.tick('00:30:00');
|
clock.tick('00:30:00');
|
||||||
|
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
|
@ -407,7 +407,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Grouped', () => {
|
describe('Grouped', () => {
|
||||||
it('Can updates', async () => {
|
test('Can updates', async () => {
|
||||||
await testGroupedChart.increment('alice');
|
await testGroupedChart.increment('alice');
|
||||||
await testGroupedChart.save();
|
await testGroupedChart.save();
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Unique increment', () => {
|
describe('Unique increment', () => {
|
||||||
it('Can updates', async () => {
|
test('Can updates', async () => {
|
||||||
await testUniqueChart.uniqueIncrement('alice');
|
await testUniqueChart.uniqueIncrement('alice');
|
||||||
await testUniqueChart.uniqueIncrement('alice');
|
await testUniqueChart.uniqueIncrement('alice');
|
||||||
await testUniqueChart.uniqueIncrement('bob');
|
await testUniqueChart.uniqueIncrement('bob');
|
||||||
|
@ -470,7 +470,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Intersection', () => {
|
describe('Intersection', () => {
|
||||||
it('条件が満たされていない場合はカウントされない', async () => {
|
test('条件が満たされていない場合はカウントされない', async () => {
|
||||||
await testIntersectionChart.addA('alice');
|
await testIntersectionChart.addA('alice');
|
||||||
await testIntersectionChart.addA('bob');
|
await testIntersectionChart.addA('bob');
|
||||||
await testIntersectionChart.addB('carol');
|
await testIntersectionChart.addB('carol');
|
||||||
|
@ -492,7 +492,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('条件が満たされている場合にカウントされる', async () => {
|
test('条件が満たされている場合にカウントされる', async () => {
|
||||||
await testIntersectionChart.addA('alice');
|
await testIntersectionChart.addA('alice');
|
||||||
await testIntersectionChart.addA('bob');
|
await testIntersectionChart.addA('bob');
|
||||||
await testIntersectionChart.addB('carol');
|
await testIntersectionChart.addB('carol');
|
||||||
|
@ -518,7 +518,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Resync', () => {
|
describe('Resync', () => {
|
||||||
it('Can resync', async () => {
|
test('Can resync', async () => {
|
||||||
testChart.total = 1;
|
testChart.total = 1;
|
||||||
|
|
||||||
await testChart.resync();
|
await testChart.resync();
|
||||||
|
@ -543,7 +543,7 @@ describe('Chart', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can resync (2)', async () => {
|
test('Can resync (2)', async () => {
|
||||||
await testChart.increment();
|
await testChart.increment();
|
||||||
await testChart.save();
|
await testChart.save();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue