summaryrefslogtreecommitdiff
path: root/test/api-visibility.ts
diff options
context:
space:
mode:
authorrinsuki <428rinsuki+git@gmail.com>2020-01-09 14:35:04 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2020-01-09 14:35:04 +0900
commit3ecb0ab1612e0887193140b1a2f8a77872a6fac1 (patch)
treed8592afad5c26ca26a6d9975a78478aee4db1c29 /test/api-visibility.ts
parent11.37.1 (diff)
downloadmisskey-3ecb0ab1612e0887193140b1a2f8a77872a6fac1.tar.gz
misskey-3ecb0ab1612e0887193140b1a2f8a77872a6fac1.tar.bz2
misskey-3ecb0ab1612e0887193140b1a2f8a77872a6fac1.zip
Add GitHub Actions (#5522)
* add .github/workflows/nodejs.yml * fix * GitHub Actions: Node.js 8.xはサポートしない * add .github/workflows/docker.yml * Dockerビルドをキャッシュするように * Run test in github actions * 同リポジトリ内からのプルリクだと無駄に二回走るのを抑制 * 6925c00のdocker.ymlへの適応忘れ * fix .circleci/misskey/test.yml * test実行時にDBとかredisとか動かすように * fix * fix tests (#5544) * fix test * fix compile errors * PATH引き継ぎでchild_process.spawn時のENOENTを修正 * サーバー起動処理を共通化 * fix coding style * fd=4をipcに使うように * fix port * fix * fix ws port * #4033 にテストケースを追従 * fix? * fix?? * fix * fix * fix * maybe fix * fix * node 10.xサポートしてなかった * 11.10じゃないとだめだった * fix * remove chart test * fix * chart test復活 * fix * 一回一回コネクションを閉じる * Revert "一回一回コネクションを閉じる" This reverts commit 56e35cf4f83070744c8dd852f1a7075011d88828. * 一回一回sync→dropしてるのをやめてみる * fix * fix * … * キャッシュを切ってみる * add ts to require target * omg fix * Revert "キャッシュを切ってみる" This reverts commit 88161c59d2ea769ddf87143ba4fd4660a06afdf2. * done呼び忘れ * 実際の文字数リミットと違ってたので対応 * テストケースがバグってたので修正 * Revert "一回一回sync→dropしてるのをやめてみる" This reverts commit a9e543ba2eef790ac7a14ae8799b898765748e35. * fix * fix * fix * fix? * fix * chartのconnectionを分離する * fix * fix * fix tsconfig? * Revert "fix tsconfig?" This reverts commit ba9269eaf65507ff97ec1dd2e27260fb2cf0510b. * fix * TS_NODE_FILES を scripts の方で指定 * Windowsェ * Circle CIの実行条件をmasterへのpushのみに Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'test/api-visibility.ts')
-rw-r--r--test/api-visibility.ts27
1 files changed, 11 insertions, 16 deletions
diff --git a/test/api-visibility.ts b/test/api-visibility.ts
index 1e263bef5b..47b222b165 100644
--- a/test/api-visibility.ts
+++ b/test/api-visibility.ts
@@ -16,20 +16,12 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as childProcess from 'child_process';
-import { async, signup, request, post } from './utils';
+import { async, signup, request, post, launchServer } from './utils';
describe('API visibility', () => {
let p: childProcess.ChildProcess;
- before(done => {
- p = childProcess.spawn('node', [__dirname + '/../index.js'], {
- stdio: ['inherit', 'inherit', 'ipc'],
- env: { NODE_ENV: 'test' }
- });
- p.on('message', message => {
- if (message === 'ok') done();
- });
- });
+ before(launchServer(g => p = g));
after(() => {
p.kill();
@@ -45,6 +37,8 @@ describe('API visibility', () => {
let other: any;
/** 非フォロワーでもリプライやメンションをされた人 */
let target: any;
+ /** specified mentionでmentionを飛ばされる人 */
+ let target2: any;
/** public-post */
let pub: any;
@@ -90,6 +84,7 @@ describe('API visibility', () => {
follower = await signup({ username: 'follower' });
other = await signup({ username: 'other' });
target = await signup({ username: 'target' });
+ target2 = await signup({ username: 'target2' });
// follow alice <= follower
await request('/following/create', { userId: alice.id }, follower);
@@ -111,7 +106,7 @@ describe('API visibility', () => {
pubM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'public' });
homeM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'home' });
folM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'followers' });
- speM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'specified' });
+ speM = await post(alice, { text: '@target2 x', replyId: tgt.id, visibility: 'specified' });
//#endregion
});
@@ -376,9 +371,9 @@ describe('API visibility', () => {
assert.strictEqual(res.body.text, '@target x');
}));
- it('[show] followers-mentionを非フォロワーがメンションされていても見れない', async(async () => {
+ it('[show] followers-mentionをメンションされていれば非フォロワーでも見れる', async(async () => {
const res = await show(folM.id, target);
- assert.strictEqual(res.body.isHidden, true);
+ assert.strictEqual(res.body.text, '@target x');
}));
it('[show] followers-mentionをフォロワーが見れる', async(async () => {
@@ -399,16 +394,16 @@ describe('API visibility', () => {
// specified
it('[show] specified-mentionを自分が見れる', async(async () => {
const res = await show(speM.id, alice);
- assert.strictEqual(res.body.text, '@target x');
+ assert.strictEqual(res.body.text, '@target2 x');
}));
it('[show] specified-mentionを指定ユーザーが見れる', async(async () => {
const res = await show(speM.id, target);
- assert.strictEqual(res.body.text, '@target x');
+ assert.strictEqual(res.body.text, '@target2 x');
}));
it('[show] specified-mentionをされた人が指定されてなかったら見れない', async(async () => {
- const res = await show(speM.id, target);
+ const res = await show(speM.id, target2);
assert.strictEqual(res.body.isHidden, true);
}));