test(api): backdate seeded evidence in report deletion tests (#3360)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-10 01:23:10 +02:00
1 parent 72f9f9c396
commit 6f344def93
2 files changed
+11

No files matched your search

@@ -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,
@@ -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();