Merge tag '2023.10.0' into merge-upstream
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { signup, api, post, react, startServer, waitFire } from '../utils.js';
|
||||
import { signup, api, post, react, startServer, waitFire, sleep } from '../utils.js';
|
||||
import type { INestApplicationContext } from '@nestjs/common';
|
||||
import type * as misskey from 'misskey-js';
|
||||
|
||||
@@ -42,6 +42,9 @@ describe('Renote Mute', () => {
|
||||
const carolRenote = await post(carol, { renoteId: bobNote.id });
|
||||
const carolNote = await post(carol, { text: 'hi' });
|
||||
|
||||
// redisに追加されるのを待つ
|
||||
await sleep(100);
|
||||
|
||||
const res = await api('/notes/local-timeline', {}, alice);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
@@ -56,6 +59,9 @@ describe('Renote Mute', () => {
|
||||
const carolRenote = await post(carol, { renoteId: bobNote.id, text: 'kore' });
|
||||
const carolNote = await post(carol, { text: 'hi' });
|
||||
|
||||
// redisに追加されるのを待つ
|
||||
await sleep(100);
|
||||
|
||||
const res = await api('/notes/local-timeline', {}, alice);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
|
||||
1097
packages/backend/test/e2e/timelines.ts
Normal file
1097
packages/backend/test/e2e/timelines.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -38,23 +38,10 @@ describe('users/notes', () => {
|
||||
await app.close();
|
||||
});
|
||||
|
||||
test('ファイルタイプ指定 (jpg)', async () => {
|
||||
test('withFiles', async () => {
|
||||
const res = await api('/users/notes', {
|
||||
userId: alice.id,
|
||||
fileType: ['image/jpeg'],
|
||||
}, alice);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(Array.isArray(res.body), true);
|
||||
assert.strictEqual(res.body.length, 2);
|
||||
assert.strictEqual(res.body.some((note: any) => note.id === jpgNote.id), true);
|
||||
assert.strictEqual(res.body.some((note: any) => note.id === jpgPngNote.id), true);
|
||||
});
|
||||
|
||||
test('ファイルタイプ指定 (jpg or png)', async () => {
|
||||
const res = await api('/users/notes', {
|
||||
userId: alice.id,
|
||||
fileType: ['image/jpeg', 'image/png'],
|
||||
withFiles: true,
|
||||
}, alice);
|
||||
|
||||
assert.strictEqual(res.status, 200);
|
||||
|
||||
@@ -134,6 +134,7 @@ describe('ユーザー', () => {
|
||||
isMuted: user.isMuted ?? false,
|
||||
isRenoteMuted: user.isRenoteMuted ?? false,
|
||||
notify: user.notify ?? 'none',
|
||||
withReplies: user.withReplies ?? false,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -92,6 +92,9 @@ describe('ActivityPub', () => {
|
||||
const metaInitial = {
|
||||
cacheRemoteFiles: true,
|
||||
cacheRemoteSensitiveFiles: true,
|
||||
perUserHomeTimelineCacheMax: 100,
|
||||
perLocalUserUserTimelineCacheMax: 100,
|
||||
perRemoteUserUserTimelineCacheMax: 100,
|
||||
blockedHosts: [] as string[],
|
||||
sensitiveWords: [] as string[],
|
||||
} as MiMeta;
|
||||
|
||||
@@ -99,9 +99,17 @@ export const relativeFetch = async (path: string, init?: RequestInit | undefined
|
||||
return await fetch(new URL(path, `http://127.0.0.1:${port}/`).toString(), init);
|
||||
};
|
||||
|
||||
export function randomString(chars = 'abcdefghijklmnopqrstuvwxyz0123456789', length = 16) {
|
||||
let randomString = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
randomString += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
return randomString;
|
||||
}
|
||||
|
||||
export const signup = async (params?: Partial<misskey.Endpoints['signup']['req']>): Promise<NonNullable<misskey.Endpoints['signup']['res']>> => {
|
||||
const q = Object.assign({
|
||||
username: 'test',
|
||||
username: randomString(),
|
||||
password: 'test',
|
||||
}, params);
|
||||
|
||||
@@ -293,12 +301,14 @@ export const uploadFile = async (user?: UserToken, { path, name, blob }: UploadO
|
||||
};
|
||||
|
||||
export const uploadUrl = async (user: UserToken, url: string) => {
|
||||
let file: any;
|
||||
let resolve: unknown;
|
||||
const file = new Promise(ok => resolve = ok);
|
||||
const marker = Math.random().toString();
|
||||
|
||||
const ws = await connectStream(user, 'main', (msg) => {
|
||||
if (msg.type === 'urlUploadFinished' && msg.body.marker === marker) {
|
||||
file = msg.body.file;
|
||||
ws.close();
|
||||
resolve(msg.body.file);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -308,9 +318,6 @@ export const uploadUrl = async (user: UserToken, url: string) => {
|
||||
force: true,
|
||||
}, user);
|
||||
|
||||
await sleep(7000);
|
||||
ws.close();
|
||||
|
||||
return file;
|
||||
};
|
||||
|
||||
@@ -450,6 +457,7 @@ export async function testPaginationConsistency<Entity extends { id: string, cre
|
||||
};
|
||||
|
||||
for (const limit of [1, 5, 10, 100, undefined]) {
|
||||
/*
|
||||
// 1. sinceId/DateとuntilId/Dateで両端を指定して取得した結果が期待通りになっていること
|
||||
if (ordering === 'desc') {
|
||||
const end = expected[expected.length - 1];
|
||||
@@ -478,6 +486,7 @@ export async function testPaginationConsistency<Entity extends { id: string, cre
|
||||
actual.map(({ id, createdAt }) => id + ':' + createdAt),
|
||||
expected.map(({ id, createdAt }) => id + ':' + createdAt));
|
||||
}
|
||||
*/
|
||||
|
||||
// 3. untilId指定+limitで取得してつなぎ合わせた結果が期待通りになっていること
|
||||
if (ordering === 'desc') {
|
||||
|
||||
Reference in New Issue
Block a user