This commit is contained in:
syuilo
2023-10-02 21:18:05 +09:00
parent c7c4c7807a
commit 8843669684
2 changed files with 202 additions and 1 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);
};
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);