signal-desktop/ts/test-both/helpers/fakeAttachment.ts
Scott Nonnenberg 99b2bc304e
Use streams to download attachments directly to disk
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
2023-10-30 09:24:28 -07:00

39 lines
883 B
TypeScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type {
AttachmentType,
AttachmentDraftType,
ThumbnailType,
} from '../../types/Attachment';
import { IMAGE_JPEG } from '../../types/MIME';
export const fakeAttachment = (
overrides: Partial<AttachmentType> = {}
): AttachmentType => ({
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,
});
export const fakeThumbnail = (url: string): ThumbnailType => ({
contentType: IMAGE_JPEG,
height: 100,
path: url,
url,
width: 100,
});
export const fakeDraftAttachment = (
overrides: Partial<AttachmentDraftType> = {}
): AttachmentDraftType => ({
pending: false,
contentType: IMAGE_JPEG,
path: 'file.jpg',
size: 10304,
...overrides,
});