signal-desktop/ts/test-both/helpers/fakeAttachment.ts

45 lines
998 B
TypeScript
Raw Normal View History

2023-01-03 19:55:46 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { v4 as generateUuid } from 'uuid';
import type {
AttachmentType,
AttachmentDraftType,
2022-03-04 21:14:52 +00:00
ThumbnailType,
AttachmentForUIType,
} from '../../types/Attachment';
import { IMAGE_JPEG } from '../../types/MIME';
export const fakeAttachment = (
overrides: Partial<AttachmentType> = {}
): 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',
...overrides,
});
2022-03-04 21:14:52 +00:00
export const fakeThumbnail = (url: string): ThumbnailType => ({
contentType: IMAGE_JPEG,
height: 100,
path: url,
url,
width: 100,
2024-05-23 21:06:41 +00:00
size: 128,
2022-03-04 21:14:52 +00:00
});
export const fakeDraftAttachment = (
overrides: Partial<AttachmentDraftType> = {}
): AttachmentDraftType => ({
pending: false,
clientUuid: generateUuid(),
contentType: IMAGE_JPEG,
path: 'file.jpg',
size: 10304,
...overrides,
});