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>
This commit is contained in:
rinsuki
2020-01-09 14:35:04 +09:00
committed by syuilo
parent 16fb7c4557
commit 3ecb0ab161
17 changed files with 192 additions and 264 deletions

View File

@ -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);
}));