Merge tag '2023.10.0' into merge-upstream

This commit is contained in:
riku6460 2023-10-10 21:22:31 +09:00
commit 5593eab248
No known key found for this signature in database
GPG key ID: 27414FA27DB94CF6
226 changed files with 5462 additions and 2914 deletions

View file

@ -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') {