2023-04-06 19:56:46 -06:00
|
|
|
process.env.NODE_ENV = "test";
|
|
|
|
|
|
|
|
import * as assert from "assert";
|
|
|
|
import * as childProcess from "child_process";
|
|
|
|
import {
|
|
|
|
async,
|
|
|
|
signup,
|
|
|
|
request,
|
|
|
|
post,
|
|
|
|
startServer,
|
|
|
|
shutdownServer,
|
|
|
|
} from "./utils.js";
|
|
|
|
|
|
|
|
describe("API visibility", () => {
|
2019-04-07 06:50:36 -06:00
|
|
|
let p: childProcess.ChildProcess;
|
|
|
|
|
2021-06-12 07:40:17 -06:00
|
|
|
before(async () => {
|
|
|
|
p = await startServer();
|
|
|
|
});
|
2019-01-28 21:46:24 -07:00
|
|
|
|
2021-06-04 23:54:07 -06:00
|
|
|
after(async () => {
|
|
|
|
await shutdownServer(p);
|
2019-01-28 21:46:24 -07:00
|
|
|
});
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
describe("Note visibility", async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
//#region vars
|
|
|
|
/** ヒロイン */
|
|
|
|
let alice: any;
|
|
|
|
/** フォロワー */
|
|
|
|
let follower: any;
|
|
|
|
/** 非フォロワー */
|
|
|
|
let other: any;
|
|
|
|
/** 非フォロワーでもリプライやメンションをされた人 */
|
|
|
|
let target: any;
|
2020-01-08 22:35:04 -07:00
|
|
|
/** specified mentionでmentionを飛ばされる人 */
|
|
|
|
let target2: any;
|
2019-01-28 21:46:24 -07:00
|
|
|
|
|
|
|
/** public-post */
|
|
|
|
let pub: any;
|
|
|
|
/** home-post */
|
|
|
|
let home: any;
|
|
|
|
/** followers-post */
|
|
|
|
let fol: any;
|
|
|
|
/** specified-post */
|
|
|
|
let spe: any;
|
|
|
|
|
|
|
|
/** public-reply to target's post */
|
|
|
|
let pubR: any;
|
|
|
|
/** home-reply to target's post */
|
|
|
|
let homeR: any;
|
|
|
|
/** followers-reply to target's post */
|
|
|
|
let folR: any;
|
|
|
|
/** specified-reply to target's post */
|
|
|
|
let speR: any;
|
|
|
|
|
|
|
|
/** public-mention to target */
|
|
|
|
let pubM: any;
|
|
|
|
/** home-mention to target */
|
|
|
|
let homeM: any;
|
|
|
|
/** followers-mention to target */
|
|
|
|
let folM: any;
|
|
|
|
/** specified-mention to target */
|
|
|
|
let speM: any;
|
|
|
|
|
|
|
|
/** reply target post */
|
|
|
|
let tgt: any;
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
const show = async (noteId: any, by: any) => {
|
2023-04-06 19:56:46 -06:00
|
|
|
return await request(
|
|
|
|
"/notes/show",
|
|
|
|
{
|
|
|
|
noteId,
|
|
|
|
},
|
|
|
|
by,
|
|
|
|
);
|
2019-01-28 21:46:24 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
//#region prepare
|
|
|
|
// signup
|
2023-04-06 19:56:46 -06:00
|
|
|
alice = await signup({ username: "alice" });
|
|
|
|
follower = await signup({ username: "follower" });
|
|
|
|
other = await signup({ username: "other" });
|
|
|
|
target = await signup({ username: "target" });
|
|
|
|
target2 = await signup({ username: "target2" });
|
2019-01-28 21:46:24 -07:00
|
|
|
|
|
|
|
// follow alice <= follower
|
2023-04-06 19:56:46 -06:00
|
|
|
await request("/following/create", { userId: alice.id }, follower);
|
2019-01-28 21:46:24 -07:00
|
|
|
|
|
|
|
// normal posts
|
2023-04-06 19:56:46 -06:00
|
|
|
pub = await post(alice, { text: "x", visibility: "public" });
|
|
|
|
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],
|
|
|
|
});
|
2019-01-28 21:46:24 -07:00
|
|
|
|
|
|
|
// replies
|
2023-04-06 19:56:46 -06:00
|
|
|
tgt = await post(target, { text: "y", visibility: "public" });
|
|
|
|
pubR = await post(alice, {
|
|
|
|
text: "x",
|
|
|
|
replyId: tgt.id,
|
|
|
|
visibility: "public",
|
|
|
|
});
|
|
|
|
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",
|
|
|
|
});
|
2019-01-28 21:46:24 -07:00
|
|
|
|
|
|
|
// mentions
|
2023-04-06 19:56:46 -06:00
|
|
|
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: "@target2 x",
|
|
|
|
replyId: tgt.id,
|
|
|
|
visibility: "specified",
|
|
|
|
});
|
2019-01-28 21:46:24 -07:00
|
|
|
//#endregion
|
|
|
|
});
|
|
|
|
|
|
|
|
//#region show post
|
|
|
|
// public
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-postを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pub.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-postをフォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pub.id, follower);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-postを非フォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pub.id, other);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-postを未認証が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pub.id, null);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
|
|
|
// home
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-postを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(home.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-postをフォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(home.id, follower);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-postを非フォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(home.id, other);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-postを未認証が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(home.id, null);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
|
|
|
// followers
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-postを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(fol.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-postをフォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(fol.id, follower);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-postを非フォロワーが見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(fol.id, other);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-postを未認証が見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(fol.id, null);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
|
|
|
// specified
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-postを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(spe.id, alice);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-postを指定ユーザーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(spe.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-postをフォロワーが見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(spe.id, follower);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-postを非フォロワーが見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(spe.id, other);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-postを未認証が見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(spe.id, null);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region show reply
|
|
|
|
// public
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-replyを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubR.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-replyをされた人が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubR.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-replyをフォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubR.id, follower);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-replyを非フォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubR.id, other);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-replyを未認証が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubR.id, null);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
|
|
|
// home
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-replyを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeR.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-replyをされた人が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeR.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-replyをフォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeR.id, follower);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-replyを非フォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeR.id, other);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-replyを未認証が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeR.id, null);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
|
|
|
// followers
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-replyを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folR.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-replyを非フォロワーでもリプライされていれば見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folR.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-replyをフォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folR.id, follower);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-replyを非フォロワーが見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folR.id, other);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-replyを未認証が見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folR.id, null);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
|
|
|
// specified
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-replyを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speR.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-replyを指定ユーザーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speR.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-replyをされた人が指定されてなくても見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speR.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-replyをフォロワーが見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speR.id, follower);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-replyを非フォロワーが見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speR.id, other);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-replyを未認証が見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speR.id, null);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region show mention
|
|
|
|
// public
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-mentionを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubM.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-mentionをされた人が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubM.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-mentionをフォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubM.id, follower);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-mentionを非フォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubM.id, other);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] public-mentionを未認証が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(pubM.id, null);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
|
|
|
// home
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-mentionを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeM.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-mentionをされた人が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeM.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-mentionをフォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeM.id, follower);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-mentionを非フォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeM.id, other);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] home-mentionを未認証が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(homeM.id, null);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
|
|
|
// followers
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-mentionを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folM.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-mentionをメンションされていれば非フォロワーでも見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folM.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-mentionをフォロワーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folM.id, follower);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-mentionを非フォロワーが見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folM.id, other);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] followers-mentionを未認証が見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(folM.id, null);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
|
|
|
// specified
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-mentionを自分が見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speM.id, alice);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target2 x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-mentionを指定ユーザーが見れる", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speM.id, target);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(res.body.text, "@target2 x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-mentionをされた人が指定されてなかったら見れない", async(async () => {
|
2020-01-08 22:35:04 -07:00
|
|
|
const res = await show(speM.id, target2);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-mentionをフォロワーが見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speM.id, follower);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-mentionを非フォロワーが見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speM.id, other);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[show] specified-mentionを未認証が見れない", async(async () => {
|
2019-01-28 21:46:24 -07:00
|
|
|
const res = await show(speM.id, null);
|
2022-07-25 10:15:21 -06:00
|
|
|
assert.strictEqual(res.status, 404);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region HTL
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[HTL] public-post が 自分が見れる", async(async () => {
|
|
|
|
const res = await request("/notes/timeline", { limit: 100 }, alice);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(res.status, 200);
|
2023-06-05 22:15:49 -06:00
|
|
|
const notes = res.body.filter((n: any) => n.id == pub.id);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(notes[0].text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[HTL] public-post が 非フォロワーから見れない", async(async () => {
|
|
|
|
const res = await request("/notes/timeline", { limit: 100 }, other);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(res.status, 200);
|
2023-06-05 22:15:49 -06:00
|
|
|
const notes = res.body.filter((n: any) => n.id == pub.id);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(notes.length, 0);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[HTL] followers-post が フォロワーから見れる", async(async () => {
|
|
|
|
const res = await request("/notes/timeline", { limit: 100 }, follower);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(res.status, 200);
|
2023-06-05 22:15:49 -06:00
|
|
|
const notes = res.body.filter((n: any) => n.id == fol.id);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(notes[0].text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region RTL
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[replies] followers-reply が フォロワーから見れる", async(async () => {
|
|
|
|
const res = await request(
|
|
|
|
"/notes/replies",
|
|
|
|
{ noteId: tgt.id, limit: 100 },
|
|
|
|
follower,
|
|
|
|
);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(res.status, 200);
|
2023-06-05 22:15:49 -06:00
|
|
|
const notes = res.body.filter((n: any) => n.id == folR.id);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(notes[0].text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[replies] followers-reply が 非フォロワー (リプライ先ではない) から見れない", async(async () => {
|
|
|
|
const res = await request(
|
|
|
|
"/notes/replies",
|
|
|
|
{ noteId: tgt.id, limit: 100 },
|
|
|
|
other,
|
|
|
|
);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(res.status, 200);
|
2023-06-05 22:15:49 -06:00
|
|
|
const notes = res.body.filter((n: any) => n.id == folR.id);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(notes.length, 0);
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[replies] followers-reply が 非フォロワー (リプライ先である) から見れる", async(async () => {
|
|
|
|
const res = await request(
|
|
|
|
"/notes/replies",
|
|
|
|
{ noteId: tgt.id, limit: 100 },
|
|
|
|
target,
|
|
|
|
);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(res.status, 200);
|
2023-06-05 22:15:49 -06:00
|
|
|
const notes = res.body.filter((n: any) => n.id == folR.id);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(notes[0].text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
2019-01-29 01:34:43 -07:00
|
|
|
//#endregion
|
2019-01-28 21:46:24 -07:00
|
|
|
|
2019-01-29 01:34:43 -07:00
|
|
|
//#region MTL
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[mentions] followers-reply が 非フォロワー (リプライ先である) から見れる", async(async () => {
|
|
|
|
const res = await request("/notes/mentions", { limit: 100 }, target);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(res.status, 200);
|
2023-06-05 22:15:49 -06:00
|
|
|
const notes = res.body.filter((n: any) => n.id == folR.id);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(notes[0].text, "x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
|
2023-04-06 19:56:46 -06:00
|
|
|
it("[mentions] followers-mention が 非フォロワー (メンション先である) から見れる", async(async () => {
|
|
|
|
const res = await request("/notes/mentions", { limit: 100 }, target);
|
2019-04-07 06:50:36 -06:00
|
|
|
assert.strictEqual(res.status, 200);
|
2023-06-05 22:15:49 -06:00
|
|
|
const notes = res.body.filter((n: any) => n.id == folM.id);
|
2023-04-06 19:56:46 -06:00
|
|
|
assert.strictEqual(notes[0].text, "@target x");
|
2019-01-28 21:46:24 -07:00
|
|
|
}));
|
|
|
|
//#endregion
|
|
|
|
});
|
|
|
|
});
|