Use PostgreSQL instead of MongoDB (#4572)
* wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * ✌️ * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * 🍕 * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * ✌️ * clean up * docs * Update push.ts * wip * Update api.ts * wip * ✌️ * Update make-pagination-query.ts * ✌️ * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * 🎨 * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * ✌️ * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * 🎨 * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * ✌️ * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * 🍣 * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * 🕓 * Fix bug * Add test * Add test * rename * Fix bug
This commit is contained in:
@ -6,40 +6,33 @@
|
||||
*
|
||||
* To specify test:
|
||||
* > mocha test/api-visibility.ts --require ts-node/register -g 'test name'
|
||||
*
|
||||
* If the tests not start, try set following enviroment variables:
|
||||
* TS_NODE_FILES=true and TS_NODE_TRANSPILE_ONLY=true
|
||||
* for more details, please see: https://github.com/TypeStrong/ts-node/issues/754
|
||||
*/
|
||||
import * as http from 'http';
|
||||
import * as assert from 'chai';
|
||||
import { async, _signup, _request, _uploadFile, _post, _react, resetDb } from './utils';
|
||||
|
||||
const expect = assert.expect;
|
||||
|
||||
//#region process
|
||||
Error.stackTraceLimit = Infinity;
|
||||
|
||||
// During the test the env variable is set to test
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
// Display detail of unhandled promise rejection
|
||||
process.on('unhandledRejection', console.dir);
|
||||
//#endregion
|
||||
|
||||
const app = require('../built/server/api').default;
|
||||
const db = require('../built/db/mongodb').default;
|
||||
|
||||
const server = http.createServer(app.callback());
|
||||
|
||||
//#region Utilities
|
||||
const request = _request(server);
|
||||
const signup = _signup(request);
|
||||
const post = _post(request);
|
||||
//#endregion
|
||||
import * as assert from 'assert';
|
||||
import * as childProcess from 'child_process';
|
||||
import { async, signup, request, post } from './utils';
|
||||
|
||||
describe('API visibility', () => {
|
||||
// Reset database each test
|
||||
before(resetDb(db));
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
||||
after(() => {
|
||||
server.close();
|
||||
p.kill();
|
||||
});
|
||||
|
||||
describe('Note visibility', async () => {
|
||||
@ -61,8 +54,6 @@ describe('API visibility', () => {
|
||||
let fol: any;
|
||||
/** specified-post */
|
||||
let spe: any;
|
||||
/** private-post */
|
||||
let pri: any;
|
||||
|
||||
/** public-reply to target's post */
|
||||
let pubR: any;
|
||||
@ -72,8 +63,6 @@ describe('API visibility', () => {
|
||||
let folR: any;
|
||||
/** specified-reply to target's post */
|
||||
let speR: any;
|
||||
/** private-reply to target's post */
|
||||
let priR: any;
|
||||
|
||||
/** public-mention to target */
|
||||
let pubM: any;
|
||||
@ -83,8 +72,6 @@ describe('API visibility', () => {
|
||||
let folM: any;
|
||||
/** specified-mention to target */
|
||||
let speM: any;
|
||||
/** private-mention to target */
|
||||
let priM: any;
|
||||
|
||||
/** reply target post */
|
||||
let tgt: any;
|
||||
@ -112,7 +99,6 @@ describe('API visibility', () => {
|
||||
home = await post(alice, { text: 'x', visibility: 'home' });
|
||||
fol = await post(alice, { text: 'x', visibility: 'followers' });
|
||||
spe = await post(alice, { text: 'x', visibility: 'specified', visibleUserIds: [target.id] });
|
||||
pri = await post(alice, { text: 'x', visibility: 'private' });
|
||||
|
||||
// replies
|
||||
tgt = await post(target, { text: 'y', visibility: 'public' });
|
||||
@ -120,14 +106,12 @@ describe('API visibility', () => {
|
||||
homeR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'home' });
|
||||
folR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'followers' });
|
||||
speR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'specified' });
|
||||
priR = await post(alice, { text: 'x', replyId: tgt.id, visibility: 'private' });
|
||||
|
||||
// mentions
|
||||
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' });
|
||||
priM = await post(alice, { text: '@target x', replyId: tgt.id, visibility: 'private' });
|
||||
//#endregion
|
||||
});
|
||||
|
||||
@ -135,111 +119,90 @@ describe('API visibility', () => {
|
||||
// public
|
||||
it('[show] public-postを自分が見れる', async(async () => {
|
||||
const res = await show(pub.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] public-postをフォロワーが見れる', async(async () => {
|
||||
const res = await show(pub.id, follower);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] public-postを非フォロワーが見れる', async(async () => {
|
||||
const res = await show(pub.id, other);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] public-postを未認証が見れる', async(async () => {
|
||||
const res = await show(pub.id, null);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
// home
|
||||
it('[show] home-postを自分が見れる', async(async () => {
|
||||
const res = await show(home.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] home-postをフォロワーが見れる', async(async () => {
|
||||
const res = await show(home.id, follower);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] home-postを非フォロワーが見れる', async(async () => {
|
||||
const res = await show(home.id, other);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] home-postを未認証が見れる', async(async () => {
|
||||
const res = await show(home.id, null);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
// followers
|
||||
it('[show] followers-postを自分が見れる', async(async () => {
|
||||
const res = await show(fol.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] followers-postをフォロワーが見れる', async(async () => {
|
||||
const res = await show(fol.id, follower);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] followers-postを非フォロワーが見れない', async(async () => {
|
||||
const res = await show(fol.id, other);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] followers-postを未認証が見れない', async(async () => {
|
||||
const res = await show(fol.id, null);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
// specified
|
||||
it('[show] specified-postを自分が見れる', async(async () => {
|
||||
const res = await show(spe.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] specified-postを指定ユーザーが見れる', async(async () => {
|
||||
const res = await show(spe.id, target);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] specified-postをフォロワーが見れない', async(async () => {
|
||||
const res = await show(spe.id, follower);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] specified-postを非フォロワーが見れない', async(async () => {
|
||||
const res = await show(spe.id, other);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] specified-postを未認証が見れない', async(async () => {
|
||||
const res = await show(spe.id, null);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
}));
|
||||
|
||||
// private
|
||||
it('[show] private-postを自分が見れる', async(async () => {
|
||||
const res = await show(pri.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
}));
|
||||
|
||||
it('[show] private-postをフォロワーが見れない', async(async () => {
|
||||
const res = await show(pri.id, follower);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
}));
|
||||
|
||||
it('[show] private-postを非フォロワーが見れない', async(async () => {
|
||||
const res = await show(pri.id, other);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
}));
|
||||
|
||||
it('[show] private-postを未認証が見れない', async(async () => {
|
||||
const res = await show(pri.id, null);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
//#endregion
|
||||
|
||||
@ -247,131 +210,110 @@ describe('API visibility', () => {
|
||||
// public
|
||||
it('[show] public-replyを自分が見れる', async(async () => {
|
||||
const res = await show(pubR.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] public-replyをされた人が見れる', async(async () => {
|
||||
const res = await show(pubR.id, target);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] public-replyをフォロワーが見れる', async(async () => {
|
||||
const res = await show(pubR.id, follower);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] public-replyを非フォロワーが見れる', async(async () => {
|
||||
const res = await show(pubR.id, other);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] public-replyを未認証が見れる', async(async () => {
|
||||
const res = await show(pubR.id, null);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
// home
|
||||
it('[show] home-replyを自分が見れる', async(async () => {
|
||||
const res = await show(homeR.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] home-replyをされた人が見れる', async(async () => {
|
||||
const res = await show(homeR.id, target);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] home-replyをフォロワーが見れる', async(async () => {
|
||||
const res = await show(homeR.id, follower);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] home-replyを非フォロワーが見れる', async(async () => {
|
||||
const res = await show(homeR.id, other);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] home-replyを未認証が見れる', async(async () => {
|
||||
const res = await show(homeR.id, null);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
// followers
|
||||
it('[show] followers-replyを自分が見れる', async(async () => {
|
||||
const res = await show(folR.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] followers-replyを非フォロワーでもリプライされていれば見れる', async(async () => {
|
||||
const res = await show(folR.id, target);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] followers-replyをフォロワーが見れる', async(async () => {
|
||||
const res = await show(folR.id, follower);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] followers-replyを非フォロワーが見れない', async(async () => {
|
||||
const res = await show(folR.id, other);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] followers-replyを未認証が見れない', async(async () => {
|
||||
const res = await show(folR.id, null);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
// specified
|
||||
it('[show] specified-replyを自分が見れる', async(async () => {
|
||||
const res = await show(speR.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] specified-replyを指定ユーザーが見れる', async(async () => {
|
||||
const res = await show(speR.id, target);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] specified-replyをされた人が指定されてなくても見れる', async(async () => {
|
||||
const res = await show(speR.id, target);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
assert.strictEqual(res.body.text, 'x');
|
||||
}));
|
||||
|
||||
it('[show] specified-replyをフォロワーが見れない', async(async () => {
|
||||
const res = await show(speR.id, follower);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] specified-replyを非フォロワーが見れない', async(async () => {
|
||||
const res = await show(speR.id, other);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] specified-replyを未認証が見れない', async(async () => {
|
||||
const res = await show(speR.id, null);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
}));
|
||||
|
||||
// private
|
||||
it('[show] private-replyを自分が見れる', async(async () => {
|
||||
const res = await show(priR.id, alice);
|
||||
expect(res.body).have.property('text').eql('x');
|
||||
}));
|
||||
|
||||
it('[show] private-replyをフォロワーが見れない', async(async () => {
|
||||
const res = await show(priR.id, follower);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
}));
|
||||
|
||||
it('[show] private-replyを非フォロワーが見れない', async(async () => {
|
||||
const res = await show(priR.id, other);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
}));
|
||||
|
||||
it('[show] private-replyを未認証が見れない', async(async () => {
|
||||
const res = await show(priR.id, null);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
//#endregion
|
||||
|
||||
@ -379,193 +321,172 @@ describe('API visibility', () => {
|
||||
// public
|
||||
it('[show] public-mentionを自分が見れる', async(async () => {
|
||||
const res = await show(pubM.id, alice);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] public-mentionをされた人が見れる', async(async () => {
|
||||
const res = await show(pubM.id, target);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] public-mentionをフォロワーが見れる', async(async () => {
|
||||
const res = await show(pubM.id, follower);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] public-mentionを非フォロワーが見れる', async(async () => {
|
||||
const res = await show(pubM.id, other);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] public-mentionを未認証が見れる', async(async () => {
|
||||
const res = await show(pubM.id, null);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
// home
|
||||
it('[show] home-mentionを自分が見れる', async(async () => {
|
||||
const res = await show(homeM.id, alice);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] home-mentionをされた人が見れる', async(async () => {
|
||||
const res = await show(homeM.id, target);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] home-mentionをフォロワーが見れる', async(async () => {
|
||||
const res = await show(homeM.id, follower);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] home-mentionを非フォロワーが見れる', async(async () => {
|
||||
const res = await show(homeM.id, other);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] home-mentionを未認証が見れる', async(async () => {
|
||||
const res = await show(homeM.id, null);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
// followers
|
||||
it('[show] followers-mentionを自分が見れる', async(async () => {
|
||||
const res = await show(folM.id, alice);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
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);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] followers-mentionをフォロワーが見れる', async(async () => {
|
||||
const res = await show(folM.id, follower);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] followers-mentionを非フォロワーが見れない', async(async () => {
|
||||
const res = await show(folM.id, other);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] followers-mentionを未認証が見れない', async(async () => {
|
||||
const res = await show(folM.id, null);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
// specified
|
||||
it('[show] specified-mentionを自分が見れる', async(async () => {
|
||||
const res = await show(speM.id, alice);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] specified-mentionを指定ユーザーが見れる', async(async () => {
|
||||
const res = await show(speM.id, target);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.text, '@target x');
|
||||
}));
|
||||
|
||||
it('[show] specified-mentionをされた人が指定されてなくても見れる', async(async () => {
|
||||
it('[show] specified-mentionをされた人が指定されてなかったら見れない', async(async () => {
|
||||
const res = await show(speM.id, target);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] specified-mentionをフォロワーが見れない', async(async () => {
|
||||
const res = await show(speM.id, follower);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] specified-mentionを非フォロワーが見れない', async(async () => {
|
||||
const res = await show(speM.id, other);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
|
||||
it('[show] specified-mentionを未認証が見れない', async(async () => {
|
||||
const res = await show(speM.id, null);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
}));
|
||||
|
||||
// private
|
||||
it('[show] private-mentionを自分が見れる', async(async () => {
|
||||
const res = await show(priM.id, alice);
|
||||
expect(res.body).have.property('text').eql('@target x');
|
||||
}));
|
||||
|
||||
it('[show] private-mentionをフォロワーが見れない', async(async () => {
|
||||
const res = await show(priM.id, follower);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
}));
|
||||
|
||||
it('[show] private-mentionを非フォロワーが見れない', async(async () => {
|
||||
const res = await show(priM.id, other);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
}));
|
||||
|
||||
it('[show] private-mentionを未認証が見れない', async(async () => {
|
||||
const res = await show(priM.id, null);
|
||||
expect(res.body).have.property('isHidden').eql(true);
|
||||
assert.strictEqual(res.body.isHidden, true);
|
||||
}));
|
||||
//#endregion
|
||||
|
||||
//#region HTL
|
||||
it('[HTL] public-post が 自分が見れる', async(async () => {
|
||||
const res = await request('/notes/timeline', { limit: 100 }, alice);
|
||||
expect(res).have.status(200);
|
||||
assert.strictEqual(res.status, 200);
|
||||
const notes = res.body.filter((n: any) => n.id == pub.id);
|
||||
expect(notes[0]).have.property('text').eql('x');
|
||||
assert.strictEqual(notes[0].text, 'x');
|
||||
}));
|
||||
|
||||
it('[HTL] public-post が 非フォロワーから見れない', async(async () => {
|
||||
const res = await request('/notes/timeline', { limit: 100 }, other);
|
||||
expect(res).have.status(200);
|
||||
assert.strictEqual(res.status, 200);
|
||||
const notes = res.body.filter((n: any) => n.id == pub.id);
|
||||
expect(notes).length(0);
|
||||
assert.strictEqual(notes.length, 0);
|
||||
}));
|
||||
|
||||
it('[HTL] followers-post が フォロワーから見れる', async(async () => {
|
||||
const res = await request('/notes/timeline', { limit: 100 }, follower);
|
||||
expect(res).have.status(200);
|
||||
assert.strictEqual(res.status, 200);
|
||||
const notes = res.body.filter((n: any) => n.id == fol.id);
|
||||
expect(notes[0]).have.property('text').eql('x');
|
||||
assert.strictEqual(notes[0].text, 'x');
|
||||
}));
|
||||
//#endregion
|
||||
|
||||
//#region RTL
|
||||
it('[replies] followers-reply が フォロワーから見れる', async(async () => {
|
||||
const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, follower);
|
||||
expect(res).have.status(200);
|
||||
assert.strictEqual(res.status, 200);
|
||||
const notes = res.body.filter((n: any) => n.id == folR.id);
|
||||
expect(notes[0]).have.property('text').eql('x');
|
||||
assert.strictEqual(notes[0].text, 'x');
|
||||
}));
|
||||
|
||||
it('[replies] followers-reply が 非フォロワー (リプライ先ではない) から見れない', async(async () => {
|
||||
const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, other);
|
||||
expect(res).have.status(200);
|
||||
assert.strictEqual(res.status, 200);
|
||||
const notes = res.body.filter((n: any) => n.id == folR.id);
|
||||
expect(notes).length(0);
|
||||
assert.strictEqual(notes.length, 0);
|
||||
}));
|
||||
|
||||
it('[replies] followers-reply が 非フォロワー (リプライ先である) から見れる', async(async () => {
|
||||
const res = await request('/notes/replies', { noteId: tgt.id, limit: 100 }, target);
|
||||
expect(res).have.status(200);
|
||||
assert.strictEqual(res.status, 200);
|
||||
const notes = res.body.filter((n: any) => n.id == folR.id);
|
||||
expect(notes[0]).have.property('text').eql('x');
|
||||
assert.strictEqual(notes[0].text, 'x');
|
||||
}));
|
||||
//#endregion
|
||||
|
||||
//#region MTL
|
||||
it('[mentions] followers-reply が 非フォロワー (リプライ先である) から見れる', async(async () => {
|
||||
const res = await request('/notes/mentions', { limit: 100 }, target);
|
||||
expect(res).have.status(200);
|
||||
assert.strictEqual(res.status, 200);
|
||||
const notes = res.body.filter((n: any) => n.id == folR.id);
|
||||
expect(notes[0]).have.property('text').eql('x');
|
||||
assert.strictEqual(notes[0].text, 'x');
|
||||
}));
|
||||
|
||||
it('[mentions] followers-mention が 非フォロワー (メンション先である) から見れる', async(async () => {
|
||||
const res = await request('/notes/mentions', { limit: 100 }, target);
|
||||
expect(res).have.status(200);
|
||||
assert.strictEqual(res.status, 200);
|
||||
const notes = res.body.filter((n: any) => n.id == folM.id);
|
||||
expect(notes[0]).have.property('text').eql('@target x');
|
||||
assert.strictEqual(notes[0].text, '@target x');
|
||||
}));
|
||||
//#endregion
|
||||
});
|
||||
|
Reference in New Issue
Block a user