Files
Desktop/ts/test-helpers/fakeAttachment.std.ts
Fedor Indutny 44076ece79 Rename files
2025-10-16 23:45:44 -07:00

45 lines
1.0 KiB
TypeScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { v4 as generateUuid } from 'uuid';
import type {
AttachmentDraftType,
ThumbnailType,
AttachmentForUIType,
} from '../types/Attachment.std.js';
import { IMAGE_JPEG } from '../types/MIME.std.js';
export const fakeAttachment = (
overrides: Partial<AttachmentForUIType> = {}
): AttachmentForUIType => ({
contentType: IMAGE_JPEG,
width: 800,
height: 600,
size: 10304,
// This is to get rid of the download buttons on most of our stories
path: 'ab/ablahblahblah',
isPermanentlyUndownloadable: false,
...overrides,
});
export const fakeThumbnail = (url: string): ThumbnailType => ({
contentType: IMAGE_JPEG,
height: 100,
path: url,
url,
width: 100,
size: 128,
});
export const fakeDraftAttachment = (
overrides: Partial<AttachmentDraftType> = {}
): AttachmentDraftType => ({
pending: false,
clientUuid: generateUuid(),
contentType: IMAGE_JPEG,
path: 'file.jpg',
size: 10304,
...overrides,
});