A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
test(api): backdate seeded evidence in report deletion tests (#3360)
Hampus6f344def93f3
diff --git a/fluxer_api/src/api/admin/tests/AdminReportDelete.test.ts b/fluxer_api/src/api/admin/tests/AdminReportDelete.test.tsindex 05d03f509..240148297 100644--- a/fluxer_api/src/api/admin/tests/AdminReportDelete.test.ts+++ b/fluxer_api/src/api/admin/tests/AdminReportDelete.test.ts@@ -130,6 +130,9 @@ describe('DELETE /admin/reports/:report_id', () => {const profileKey = `reports/${reportId}/profile/user_avatar/abc${id}`;await harness.storageService.uploadObject({bucket: REPORTS_BUCKET, key: attachmentKey, body: new Uint8Array([1])});await harness.storageService.uploadObject({bucket: REPORTS_BUCKET, key: profileKey, body: new Uint8Array([2])});+ const uploadedAt = new Date(Date.now() - ms('1 hour'));+ harness.storageService.setObjectLastModified(REPORTS_BUCKET, attachmentKey, uploadedAt);+ harness.storageService.setObjectLastModified(REPORTS_BUCKET, profileKey, uploadedAt);const report = await repository.createReport({...Object.fromEntries(IAR_SUBMISSION_COLUMNS.map((column) => [column, null])),report_id: id,diff --git a/fluxer_api/src/api/test/mocks/MockStorageService.ts b/fluxer_api/src/api/test/mocks/MockStorageService.tsindex e6cbf9cb9..37cb6719a 100644--- a/fluxer_api/src/api/test/mocks/MockStorageService.ts+++ b/fluxer_api/src/api/test/mocks/MockStorageService.ts@@ -556,6 +556,14 @@ export class MockStorageService implements IStorageService {return this.objects.has(this.objectId(bucket, key));}+ setObjectLastModified(bucket: string, key: string, lastModified: Date): void {+ const object = this.objects.get(this.objectId(bucket, key));+ if (!object) {+ throw new Error(`No stored object ${key} in ${bucket}`);+ }+ object.lastModified = lastModified;+ }+reset(): void {this.objects.clear();this.multipartUploads.clear();