mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-11 06:34:05 +02:00
Merge branch 'develop' into renovate/major-backend-update-dependencies
This commit is contained in:
@@ -363,14 +363,11 @@ describe('クリップ', () => {
|
||||
const clipLimit = DEFAULT_POLICIES.clipLimit;
|
||||
const clips = await createMany({}, clipLimit);
|
||||
const res = await list({
|
||||
parameters: { limit: 1 }, // FIXME: 無視されて11全部返ってくる
|
||||
parameters: { limit: clips.length },
|
||||
});
|
||||
|
||||
// 返ってくる配列には順序保障がないのでidでソートして厳密比較
|
||||
assert.deepStrictEqual(
|
||||
res.sort(compareBy(s => s.id)),
|
||||
clips.sort(compareBy(s => s.id)),
|
||||
);
|
||||
// 作成responseの配列には順序保障がないのでidでソートして厳密比較
|
||||
assert.deepStrictEqual(res.toReversed(), clips.sort(compareBy(s => s.id)));
|
||||
});
|
||||
|
||||
test('の一覧が取得できる(空)', async () => {
|
||||
|
||||
@@ -40,6 +40,7 @@ describe('NoteCreateService', () => {
|
||||
renoteCount: 0,
|
||||
repliesCount: 0,
|
||||
clippedCount: 0,
|
||||
pageCount: 0,
|
||||
reactions: {},
|
||||
visibility: 'public',
|
||||
uri: null,
|
||||
|
||||
@@ -23,6 +23,7 @@ const base: MiNote = {
|
||||
renoteCount: 0,
|
||||
repliesCount: 0,
|
||||
clippedCount: 0,
|
||||
pageCount: 0,
|
||||
reactions: {},
|
||||
visibility: 'public',
|
||||
uri: null,
|
||||
|
||||
@@ -158,6 +158,7 @@ describe('CleanRemoteNotesProcessorService', () => {
|
||||
oldest: null,
|
||||
newest: null,
|
||||
skipped: true,
|
||||
transientErrors: 0,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -172,6 +173,7 @@ describe('CleanRemoteNotesProcessorService', () => {
|
||||
oldest: null,
|
||||
newest: null,
|
||||
skipped: false,
|
||||
transientErrors: 0,
|
||||
});
|
||||
}, 3000);
|
||||
|
||||
@@ -199,6 +201,7 @@ describe('CleanRemoteNotesProcessorService', () => {
|
||||
oldest: expect.any(Number),
|
||||
newest: expect.any(Number),
|
||||
skipped: false,
|
||||
transientErrors: 0,
|
||||
});
|
||||
|
||||
// Check side-by-side from all notes
|
||||
@@ -278,6 +281,24 @@ describe('CleanRemoteNotesProcessorService', () => {
|
||||
expect(remainingNote).not.toBeNull();
|
||||
});
|
||||
|
||||
// ページ
|
||||
test('should not delete note that is embedded in a page', async () => {
|
||||
const job = createMockJob();
|
||||
|
||||
// Create old remote note that is embedded in a page
|
||||
const clippedNote = await createNote({
|
||||
pageCount: 1, // Embedded in a page
|
||||
}, bob, Date.now() - ms(`${meta.remoteNotesCleaningExpiryDaysForEachNotes} days`) - 1000);
|
||||
|
||||
const result = await service.process(job as any);
|
||||
|
||||
expect(result.deletedCount).toBe(0);
|
||||
expect(result.skipped).toBe(false);
|
||||
|
||||
const remainingNote = await notesRepository.findOneBy({ id: clippedNote.id });
|
||||
expect(remainingNote).not.toBeNull();
|
||||
});
|
||||
|
||||
// 古いreply, renoteが含まれている時の挙動
|
||||
test('should handle reply/renote relationships correctly', async () => {
|
||||
const job = createMockJob();
|
||||
|
||||
@@ -317,7 +317,7 @@ export const uploadFile = async (user?: UserToken, { path, name, blob }: UploadO
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', blob ??
|
||||
new File([await readFile(absPath)], basename(absPath.toString())));
|
||||
new File([new Uint8Array(await readFile(absPath))], basename(absPath.toString())));
|
||||
formData.append('force', 'true');
|
||||
if (name) {
|
||||
formData.append('name', name);
|
||||
@@ -608,8 +608,8 @@ export async function initTestDb(justBorrow = false, initEntities?: any[]) {
|
||||
username: config.db.user,
|
||||
password: config.db.pass,
|
||||
database: config.db.db,
|
||||
synchronize: true && !justBorrow,
|
||||
dropSchema: true && !justBorrow,
|
||||
synchronize: !justBorrow,
|
||||
dropSchema: !justBorrow,
|
||||
entities: initEntities ?? entities,
|
||||
});
|
||||
|
||||
@@ -661,7 +661,9 @@ export async function captureWebhook<T = SystemWebhookPayload>(postAction: () =>
|
||||
let timeoutHandle: NodeJS.Timeout | null = null;
|
||||
const result = await new Promise<string>(async (resolve, reject) => {
|
||||
fastify.all('/', async (req, res) => {
|
||||
timeoutHandle && clearTimeout(timeoutHandle);
|
||||
if (timeoutHandle) {
|
||||
clearTimeout(timeoutHandle);
|
||||
}
|
||||
|
||||
const body = JSON.stringify(req.body);
|
||||
res.status(200).send('ok');
|
||||
|
||||
Reference in New Issue
Block a user