Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

composerFiles.test.ts

700 lines22.5 KB

1import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
2import type { ImagePickerAsset } from "expo-image-picker";
3​
4const mocks = vi.hoisted(() => ({
5 documentUri: "file:///documents",
6 pickFile: vi.fn(),
7 pickMedia: vi.fn(),
8 copy: vi.fn(),
9 delete: vi.fn(),
10 open: vi.fn(),
11 size: vi.fn(),
12}));
13​
14vi.mock("expo-file-system", () => {
15 class Directory {
16 readonly uri: string;
17​
18 constructor(root: string | { readonly uri: string }, name: string) {
19 this.uri = `${typeof root === "string" ? root : root.uri}/${name}`;
20 }
21​
22 create(): void {}
23 }
24​
25 class File {
26 readonly uri: string;
27​
28 constructor(source: string | Directory, name?: string) {
29 this.uri = source instanceof Directory ? `${source.uri}/${name}` : source;
30 }
31​
32 get exists(): boolean {
33 return true;
34 }
35​
36 get size(): number | null {
37 return mocks.size(this.uri) ?? null;
38 }
39​
40 get name(): string {
41 return this.uri.split("/").at(-1) ?? "";
42 }
43​
44 get type(): string {
45 return "video/quicktime";
46 }
47​
48 create(): void {}
49​
50 open(mode: string) {
51 return mocks.open(this.uri, mode);
52 }
53​
54 async copy(destination: File): Promise<void> {
55 mocks.copy(this.uri, destination.uri);
56 }
57​
58 delete(): void {
59 mocks.delete(this.uri);
60 }
61 }
62​
63 return {
64 Directory,
65 File,
66 FileMode: { ReadOnly: "r", WriteOnly: "w" },
67 Paths: {
68 get document() {
69 return { uri: mocks.documentUri };
70 },
71 },
72 };
73});
74​
75vi.mock("expo-image-picker", () => ({ launchImageLibraryAsync: mocks.pickMedia }));
76vi.mock("expo-document-picker", () => ({ getDocumentAsync: mocks.pickFile }));
77vi.mock("./uuid", () => ({ uuidv4: () => "attachment-id" }));
78​
79import {
80 persistComposerAttachmentFile,
81 pickComposerFiles,
82 pickComposerImages,
83 pickComposerMedia,
84 removePersistedComposerAttachmentFile,
85} from "./composerImages";
86import { isForegroundHandoffActive } from "./foreground-handoff";
87import { retainComposerAttachmentFile } from "./composerAttachmentFiles";
88​
89describe("composer file attachments", () => {
90 beforeEach(() => {
91 mocks.documentUri = "file:///documents";
92 mocks.pickFile.mockReset();
93 mocks.pickMedia.mockReset();
94 mocks.copy.mockReset();
95 mocks.delete.mockReset();
96 mocks.open.mockReset();
97 mocks.size.mockReset();
98 mocks.size.mockImplementation((uri: string) => (uri.startsWith("content:") ? null : 42));
99 });
100​
101 describe("photo library videos", () => {
102 const image: ImagePickerAsset = {
103 uri: "file:///picker/photo.png",
104 type: "image",
105 fileName: "photo.png",
106 mimeType: "image/png",
107 fileSize: 3,
108 base64: "YWJj",
109 width: 1,
110 height: 1,
111 };
112 const video: ImagePickerAsset = {
113 uri: "file:///picker/clip.mov",
114 type: "video",
115 fileName: "clip.mov",
116 mimeType: "video/quicktime",
117 fileSize: 20 * 1024 * 1024,
118 base64: null,
119 width: 1920,
120 height: 1080,
121 };
122​
123 it("retains mixed photos and videos, keeping video bytes in durable file storage", async () => {
124 mocks.pickMedia.mockResolvedValue({ canceled: false, assets: [image, video] });
125 mocks.size.mockReturnValue(video.fileSize);
126​
127 const result = await pickComposerMedia({ existingCount: 0, maxVideoBytes: 50 * 1024 * 1024 });
128​
129 expect(mocks.pickMedia).toHaveBeenCalledWith(
130 expect.objectContaining({
131 mediaTypes: ["images", "videos"],
132 shouldDownloadFromNetwork: true,
133 }),
134 );
135 expect(result).toEqual({
136 attachments: [
137 expect.objectContaining({ type: "image", dataUrl: "data:image/png;base64,YWJj" }),
138 {
139 id: "attachment-id",
140 type: "file",
141 name: "clip.mov",
142 mimeType: "video/quicktime",
143 sizeBytes: video.fileSize,
144 fileUri: "file:///documents/t3-composer-attachments/attachment-id-clip.mov",
145 },
146 ],
147 error: null,
148 });
149 expect(mocks.copy).toHaveBeenCalledWith(
150 video.uri,
151 "file:///documents/t3-composer-attachments/attachment-id-clip.mov",
152 );
153 expect(mocks.delete).not.toHaveBeenCalled();
154 });
155​
156 it("keeps image-only destinations on the image picker path", async () => {
157 mocks.pickMedia.mockResolvedValue({ canceled: false, assets: [image] });
158​
159 const result = await pickComposerImages({ existingCount: 0 });
160​
161 expect(mocks.pickMedia).toHaveBeenCalledWith(
162 expect.objectContaining({ mediaTypes: ["images"] }),
163 );
164 expect(result.images).toEqual([
165 expect.objectContaining({ type: "image", name: "photo.png" }),
166 ]);
167 expect(result.error).toBeNull();
168 expect(mocks.copy).not.toHaveBeenCalled();
169 });
170​
171 it("does not persist videos when the destination lacks file support", async () => {
172 mocks.pickMedia.mockResolvedValue({ canceled: false, assets: [video, image] });
173​
174 const result = await pickComposerMedia({ existingCount: 0 });
175​
176 expect(result.attachments).toEqual([expect.objectContaining({ type: "image" })]);
177 expect(result.error).toBe("Video attachments are unavailable here.");
178 expect(mocks.copy).not.toHaveBeenCalled();
179 });
180​
181 it("uses local video metadata when the picker omits its name, MIME type, or size", async () => {
182 mocks.pickMedia.mockResolvedValue({
183 canceled: false,
184 assets: [{ ...video, fileName: null, mimeType: undefined, fileSize: undefined }],
185 });
186​
187 const result = await pickComposerMedia({ existingCount: 0, maxVideoBytes: 1024 });
188​
189 expect(result.error).toBeNull();
190 expect(result.attachments).toEqual([
191 expect.objectContaining({
192 type: "file",
193 name: "clip.mov",
194 mimeType: "video/quicktime",
195 sizeBytes: 42,
196 }),
197 ]);
198 });
199​
200 it.each([
201 {
202 reason: "picker size exceeds the server limit",
203 reported: 2 * 1024 * 1024,
204 stored: 42,
205 limit: 1024 * 1024,
206 error: "'clip.mov' exceeds the 1 MB attachment limit.",
207 },
208 {
209 reason: "actual size exceeds the server limit",
210 reported: 42,
211 stored: 2 * 1024 * 1024,
212 limit: 1024 * 1024,
213 error: "'clip.mov' exceeds the 1 MB attachment limit.",
214 },
215 {
216 reason: "stored copy is empty",
217 reported: 42,
218 stored: 0,
219 limit: 1024 * 1024,
220 error: "'clip.mov' is empty or could not be read.",
221 },
222 {
223 reason: "server advertises more than the contract limit",
224 reported: 51 * 1024 * 1024,
225 stored: 42,
226 limit: 80 * 1024 * 1024,
227 error: "'clip.mov' exceeds the 50 MB attachment limit.",
228 },
229 ])(
230 "rejects a video when $reason while retaining the selected photo",
231 async ({ reported, stored, limit, error }) => {
232 mocks.pickMedia.mockResolvedValue({
233 canceled: false,
234 assets: [{ ...video, fileSize: reported }, image],
235 });
236 mocks.size.mockReturnValue(stored);
237​
238 const result = await pickComposerMedia({ existingCount: 0, maxVideoBytes: limit });
239​
240 expect(result).toEqual({
241 attachments: [expect.objectContaining({ type: "image" })],
242 error,
243 });
244 if (stored === 0) {
245 expect(mocks.delete).toHaveBeenCalledWith(
246 "file:///documents/t3-composer-attachments/attachment-id-clip.mov",
247 );
248 }
249 },
250 );
251​
252 it("applies the remaining attachment slots to photos and videos together", async () => {
253 mocks.pickMedia.mockResolvedValue({ canceled: false, assets: [image, video] });
254​
255 const result = await pickComposerMedia({ existingCount: 7, maxVideoBytes: 50 * 1024 * 1024 });
256​
257 expect(result.attachments).toEqual([expect.objectContaining({ type: "image" })]);
258 expect(result.error).toBe("You can attach up to 8 attachments per message.");
259 expect(mocks.pickMedia).toHaveBeenCalledWith(expect.objectContaining({ selectionLimit: 1 }));
260 expect(mocks.copy).not.toHaveBeenCalled();
261 });
262​
263 it("reports a native video retrieval error and ends the foreground handoff", async () => {
264 mocks.pickMedia.mockRejectedValue(new Error("Could not download video from iCloud."));
265​
266 await expect(pickComposerMedia({ existingCount: 0, maxVideoBytes: 1024 })).resolves.toEqual({
267 attachments: [],
268 error: "Could not download video from iCloud.",
269 });
270 expect(isForegroundHandoffActive()).toBe(false);
271 });
272 });
273​
274 it("copies picked files into app-owned storage without loading their contents", async () => {
275 mocks.pickFile.mockResolvedValue({
276 canceled: false,
277 assets: [
278 {
279 uri: "file:///downloads/report.pdf",
280 name: "report.pdf",
281 mimeType: "application/pdf",
282 size: 42,
283 },
284 ],
285 });
286​
287 await expect(pickComposerFiles({ existingCount: 0 })).resolves.toEqual({
288 files: [
289 {
290 id: "attachment-id",
291 type: "file",
292 name: "report.pdf",
293 mimeType: "application/pdf",
294 sizeBytes: 42,
295 fileUri: "file:///documents/t3-composer-attachments/attachment-id-report.pdf",
296 },
297 ],
298 error: null,
299 });
300 expect(mocks.copy).toHaveBeenCalledWith(
301 "file:///downloads/report.pdf",
302 "file:///documents/t3-composer-attachments/attachment-id-report.pdf",
303 );
304 });
305​
306 it("preserves Android picker metadata instead of using the content URI document id", async () => {
307 const uri = "content://com.android.providers.media.documents/document/video%3A18";
308 mocks.pickFile.mockResolvedValue({
309 canceled: false,
310 assets: [
311 {
312 uri,
313 name: "preview-h264.mp4",
314 mimeType: "video/mp4",
315 size: 620_992,
316 lastModified: 0,
317 },
318 ],
319 });
320 mocks.size.mockReturnValue(620_992);
321​
322 await expect(pickComposerFiles({ existingCount: 0 })).resolves.toEqual({
323 files: [
324 {
325 id: "attachment-id",
326 type: "file",
327 name: "preview-h264.mp4",
328 mimeType: "video/mp4",
329 sizeBytes: 620_992,
330 fileUri: "file:///documents/t3-composer-attachments/attachment-id-preview-h264.mp4",
331 },
332 ],
333 error: null,
334 });
335 expect(mocks.pickFile).toHaveBeenCalledWith({ multiple: true, copyToCacheDirectory: true });
336 expect(mocks.copy).toHaveBeenCalledWith(
337 uri,
338 "file:///documents/t3-composer-attachments/attachment-id-preview-h264.mp4",
339 );
340 expect(mocks.delete).not.toHaveBeenCalled();
341 });
342​
343 it("persists provider selections that require a readable cache copy", async () => {
344 const providerUri = "content://cloud-provider/documents/clip";
345 const cachedUri = "file:///cache/DocumentPicker/clip.mp4";
346 mocks.pickFile.mockImplementation(async (options) => ({
347 canceled: false,
348 assets: [
349 {
350 uri: options.copyToCacheDirectory ? cachedUri : providerUri,
351 name: "Cloud recording.mp4",
352 mimeType: "video/mp4",
353 size: 42,
354 lastModified: 0,
355 },
356 ],
357 }));
358 mocks.copy.mockImplementation((uri: string) => {
359 if (uri === providerUri) throw new Error("The provider URI is not directly readable.");
360 });
361​
362 const result = await pickComposerFiles({ existingCount: 0 });
363​
364 expect(result.error).toBeNull();
365 expect(result.files).toEqual([
366 expect.objectContaining({
367 name: "Cloud recording.mp4",
368 fileUri: "file:///documents/t3-composer-attachments/attachment-id-Cloud recording.mp4",
369 }),
370 ]);
371 expect(mocks.copy).toHaveBeenCalledWith(cachedUri, result.files[0]!.fileUri);
372 });
373​
374 it("ends the foreground handoff when the picker is canceled without copying files", async () => {
375 mocks.pickFile.mockImplementation(async () => {
376 expect(isForegroundHandoffActive()).toBe(true);
377 return { canceled: true, assets: null };
378 });
379​
380 await expect(pickComposerFiles({ existingCount: 0 })).resolves.toEqual({
381 files: [],
382 error: null,
383 });
384​
385 expect(isForegroundHandoffActive()).toBe(false);
386 expect(mocks.copy).not.toHaveBeenCalled();
387 expect(mocks.open).not.toHaveBeenCalled();
388 });
389​
390 it("reports picker failures and releases the foreground handoff", async () => {
391 mocks.pickFile.mockRejectedValue(new Error("The document provider is unavailable."));
392​
393 await expect(pickComposerFiles({ existingCount: 0 })).resolves.toEqual({
394 files: [],
395 error: "The document provider is unavailable.",
396 });
397​
398 expect(isForegroundHandoffActive()).toBe(false);
399 expect(mocks.copy).not.toHaveBeenCalled();
400 });
401​
402 it("does not open the picker when the draft has no remaining attachment slots", async () => {
403 await expect(pickComposerFiles({ existingCount: 8 })).resolves.toEqual({
404 files: [],
405 error: "You can attach up to 8 files per message.",
406 });
407​
408 expect(mocks.pickFile).not.toHaveBeenCalled();
409 expect(isForegroundHandoffActive()).toBe(false);
410 });
411​
412 it("falls back to a usable name when the picker reports a blank one", async () => {
413 mocks.pickFile.mockResolvedValue({
414 canceled: false,
415 assets: [
416 {
417 uri: "file:///downloads/unnamed",
418 name: " ",
419 mimeType: "application/pdf",
420 size: 42,
421 },
422 ],
423 });
424​
425 const result = await pickComposerFiles({ existingCount: 0 });
426 expect(result.error).toBeNull();
427 expect(result.files).toHaveLength(1);
428 expect(result.files[0]?.name).toBe("file");
429 });
430​
431 it("rejects files that exceed the environment's advertised upload limit", async () => {
432 mocks.pickFile.mockResolvedValue({
433 canceled: false,
434 assets: [
435 {
436 uri: "file:///downloads/archive.zip",
437 name: "archive.zip",
438 mimeType: "application/zip",
439 size: 2 * 1024 * 1024,
440 },
441 ],
442 });
443​
444 await expect(pickComposerFiles({ existingCount: 0, maxBytes: 1024 * 1024 })).resolves.toEqual({
445 files: [],
446 error: "'archive.zip' exceeds the 1 MB attachment limit.",
447 });
448 expect(mocks.copy).not.toHaveBeenCalled();
449 });
450​
451 it("never accepts files above the 50 MB contract limit", async () => {
452 mocks.pickFile.mockResolvedValue({
453 canceled: false,
454 assets: [
455 {
456 uri: "file:///downloads/archive.zip",
457 name: "archive.zip",
458 mimeType: "application/zip",
459 size: 51 * 1024 * 1024,
460 },
461 ],
462 });
463​
464 await expect(
465 pickComposerFiles({ existingCount: 0, maxBytes: 80 * 1024 * 1024 }),
466 ).resolves.toEqual({
467 files: [],
468 error: "'archive.zip' exceeds the 50 MB attachment limit.",
469 });
470 });
471​
472 it("rejects a file that grew after the picker reported its size", async () => {
473 mocks.pickFile.mockResolvedValue({
474 canceled: false,
475 assets: [
476 {
477 uri: "file:///downloads/archive.zip",
478 name: "archive.zip",
479 mimeType: "application/zip",
480 size: 42,
481 },
482 ],
483 });
484 mocks.size.mockReturnValue(2 * 1024 * 1024);
485​
486 await expect(pickComposerFiles({ existingCount: 0, maxBytes: 1024 * 1024 })).resolves.toEqual({
487 files: [],
488 error: "'archive.zip' exceeds the 1 MB attachment limit.",
489 });
490 expect(mocks.copy).not.toHaveBeenCalled();
491 });
492​
493 it("stops copying an unknown-size content URI when it exceeds the attachment limit", async () => {
494 const maxBytes = 1024 * 1024;
495 let remainingBytes = maxBytes + 1;
496 const source = {
497 readBytes: vi.fn((length: number) => {
498 const size = Math.min(length, remainingBytes);
499 remainingBytes -= size;
500 return new Uint8Array(size);
501 }),
502 close: vi.fn(),
503 };
504 const destination = { writeBytes: vi.fn(), close: vi.fn() };
505 mocks.open.mockImplementation((uri: string) =>
506 uri.startsWith("content:") ? source : destination,
507 );
508​
509 await expect(
510 persistComposerAttachmentFile("content://shared/large", "large.bin", maxBytes),
511 ).rejects.toThrow("'large.bin' exceeds the 1 MB attachment limit.");
512​
513 expect(source.close).toHaveBeenCalledOnce();
514 expect(destination.close).toHaveBeenCalledOnce();
515 expect(mocks.delete).toHaveBeenCalledWith(
516 "file:///documents/t3-composer-attachments/attachment-id-large.bin",
517 );
518 expect(mocks.copy).not.toHaveBeenCalled();
519 });
520​
521 it("rejects a copy that delivered more bytes than the source reported", async () => {
522 const maxBytes = 1024 * 1024;
523 // An Android content: stream can report a small size and still deliver
524 // more bytes; the persisted copy is what must satisfy the limit.
525 mocks.size.mockImplementation((uri: string) =>
526 uri.startsWith("content:") ? 42 : 2 * 1024 * 1024,
527 );
528​
529 await expect(
530 persistComposerAttachmentFile("content://shared/liar", "liar.bin", maxBytes),
531 ).rejects.toThrow("'liar.bin' exceeds the 1 MB attachment limit.");
532​
533 expect(mocks.copy).toHaveBeenCalledOnce();
534 expect(mocks.delete).toHaveBeenCalledWith(
535 "file:///documents/t3-composer-attachments/attachment-id-liar.bin",
536 );
537 });
538​
539 it("reports an empty file without calling it oversized", async () => {
540 mocks.size.mockReturnValue(0);
541 mocks.pickFile.mockResolvedValue({
542 canceled: false,
543 assets: [
544 {
545 uri: "file:///downloads/empty.txt",
546 name: "empty.txt",
547 mimeType: "text/plain",
548 size: 0,
549 },
550 ],
551 });
552​
553 await expect(pickComposerFiles({ existingCount: 0 })).resolves.toEqual({
554 files: [],
555 error: "'empty.txt' is empty or could not be read.",
556 });
557 });
558​
559 it.each([0, undefined])("copies an Android SAF file when the picker size is %s", async (size) => {
560 const reader = {
561 readBytes: vi
562 .fn()
563 .mockReturnValueOnce(new Uint8Array(42))
564 .mockReturnValueOnce(new Uint8Array()),
565 close: vi.fn(),
566 };
567 const writer = { writeBytes: vi.fn(), close: vi.fn() };
568 mocks.size.mockImplementation((uri: string) => (uri.startsWith("content:") ? 0 : 42));
569 mocks.open.mockImplementation((uri: string) => (uri.startsWith("content:") ? reader : writer));
570 mocks.pickFile.mockResolvedValue({
571 canceled: false,
572 assets: [
573 {
574 uri: "content://shared/report",
575 name: "report.pdf",
576 mimeType: "application/pdf",
577 size,
578 },
579 ],
580 });
581​
582 await expect(pickComposerFiles({ existingCount: 0 })).resolves.toEqual({
583 files: [
584 {
585 id: "attachment-id",
586 type: "file",
587 name: "report.pdf",
588 mimeType: "application/pdf",
589 sizeBytes: 42,
590 fileUri: "file:///documents/t3-composer-attachments/attachment-id-report.pdf",
591 },
592 ],
593 error: null,
594 });
595 });
596​
597 it("uses the remaining slot for the first valid file after an oversized selection", async () => {
598 mocks.pickFile.mockResolvedValue({
599 canceled: false,
600 assets: [
601 {
602 uri: "file:///downloads/huge.zip",
603 name: "huge.zip",
604 mimeType: "application/zip",
605 size: 2 * 1024 * 1024,
606 },
607 {
608 uri: "file:///downloads/report.pdf",
609 name: "report.pdf",
610 mimeType: "application/pdf",
611 size: 42,
612 },
613 ],
614 });
615​
616 const result = await pickComposerFiles({ existingCount: 7, maxBytes: 1024 * 1024 });
617​
618 expect(result.files.map((file) => file.name)).toEqual(["report.pdf"]);
619 });
620​
621 it("removes the partial destination file when a copy fails midway", async () => {
622 mocks.copy.mockImplementation(() => {
623 throw new Error("disk full");
624 });
625​
626 await expect(
627 persistComposerAttachmentFile("file:///downloads/report.pdf", "report.pdf"),
628 ).rejects.toThrow("disk full");
629​
630 expect(mocks.delete).toHaveBeenCalledWith(
631 "file:///documents/t3-composer-attachments/attachment-id-report.pdf",
632 );
633 });
634​
635 it("deletes app-owned attachments without touching user-owned files", async () => {
636 await removePersistedComposerAttachmentFile(
637 "file:///documents/t3-composer-attachments/report.pdf",
638 );
639 await removePersistedComposerAttachmentFile("file:///downloads/report.pdf");
640​
641 expect(mocks.delete).toHaveBeenCalledOnce();
642 expect(mocks.delete).toHaveBeenCalledWith(
643 "file:///documents/t3-composer-attachments/report.pdf",
644 );
645 });
646​
647 it("removes a restored attachment from the current iOS document container", async () => {
648 const fileName = "33333333-3333-4333-8333-333333333333-report%20%23.pdf";
649 const oldUri = `file:///private/var/mobile/Containers/Data/Application/11111111-1111-4111-8111-111111111111/Documents/t3-composer-attachments/${fileName}`;
650 mocks.documentUri =
651 "file:///var/mobile/Containers/Data/Application/22222222-2222-4222-8222-222222222222/Documents";
652​
653 await removePersistedComposerAttachmentFile(oldUri);
654 await removePersistedComposerAttachmentFile(
655 `file:///var/mobile/Containers/Shared/FileProvider/other/Documents/t3-composer-attachments/${fileName}`,
656 );
657 await removePersistedComposerAttachmentFile(
658 `${mocks.documentUri}/t3-composer-attachments/..%2F..%2Fsender.pdf`,
659 );
660​
661 expect(mocks.delete.mock.calls).toEqual([
662 [`${mocks.documentUri}/t3-composer-attachments/${fileName}`],
663 ]);
664 });
665​
666 it("rechecks preview ownership after loading the native filesystem", async () => {
667 const fileName = "33333333-3333-4333-8333-333333333333-recording.mp4";
668 const oldUri = `file:///private/var/mobile/Containers/Data/Application/11111111-1111-4111-8111-111111111111/Documents/t3-composer-attachments/${fileName}`;
669 mocks.documentUri =
670 "file:///var/mobile/Containers/Data/Application/22222222-2222-4222-8222-222222222222/Documents";
671 const currentUri = `${mocks.documentUri}/t3-composer-attachments/${fileName}`;
672​
673 const deleting = removePersistedComposerAttachmentFile(oldUri);
674 const release = retainComposerAttachmentFile(currentUri, () => {});
675 try {
676 await deleting;
677 expect(mocks.delete).not.toHaveBeenCalled();
678 } finally {
679 release();
680 }
681​
682 await removePersistedComposerAttachmentFile(oldUri);
683 expect(mocks.delete.mock.calls).toEqual([[currentUri]]);
684 });
685​
686 it("copies an open-in-place source from its actual container without rebasing it", async () => {
687 const sourceUri =
688 "file:///var/mobile/Containers/Data/Application/11111111-1111-4111-8111-111111111111/Documents/t3-composer-attachments/33333333-3333-4333-8333-333333333333-report.pdf";
689 mocks.documentUri =
690 "file:///var/mobile/Containers/Data/Application/22222222-2222-4222-8222-222222222222/Documents";
691​
692 await persistComposerAttachmentFile(sourceUri, "report.pdf");
693​
694 expect(mocks.copy).toHaveBeenCalledWith(
695 sourceUri,
696 `${mocks.documentUri}/t3-composer-attachments/attachment-id-report.pdf`,
697 );
698 expect(mocks.delete).not.toHaveBeenCalled();
699 });
700});