|
1 | 1 | import { vi } from "vitest";
|
2 | 2 |
|
3 |
| -export function mockedCommentsCollection(): GoogleAppsScript.Drive_v3.Drive.V3.Collection.CommentsCollection { |
4 |
| - return { |
5 |
| - create: |
6 |
| - vi.fn< |
7 |
| - ( |
8 |
| - resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment, |
9 |
| - fileId: string, |
10 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment |
11 |
| - >(), |
12 |
| - get: vi.fn< |
13 |
| - ( |
14 |
| - fileId: string, |
15 |
| - commentId: string, |
16 |
| - optionalArgs?: Record<string, any>, |
17 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment |
18 |
| - >(), |
19 |
| - list: vi.fn< |
20 |
| - ( |
21 |
| - fileId: string, |
22 |
| - optionalArgs?: Record<string, any>, |
23 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.CommentList |
24 |
| - >(), |
25 |
| - remove: vi.fn<(fileId: string, commentId: string) => void>(), |
26 |
| - update: |
27 |
| - vi.fn< |
28 |
| - ( |
29 |
| - resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment, |
30 |
| - fileId: string, |
31 |
| - commentId: string, |
32 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment |
33 |
| - >(), |
34 |
| - }; |
35 |
| -} |
| 3 | +/* eslint-disable @typescript-eslint/no-explicit-any -- These are stubs for external functions */ |
36 | 4 |
|
37 | 5 | export function mockedDrive(): GoogleAppsScript.Drive {
|
38 | 6 | return {
|
@@ -149,129 +117,6 @@ export function mockedDrive(): GoogleAppsScript.Drive {
|
149 | 117 | };
|
150 | 118 | }
|
151 | 119 |
|
152 |
| -export function mockedDrivesCollection(): GoogleAppsScript.Drive_v3.Drive.V3.Collection.DrivesCollection { |
153 |
| - return { |
154 |
| - create: |
155 |
| - vi.fn< |
156 |
| - ( |
157 |
| - resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive, |
158 |
| - requestId: string, |
159 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
160 |
| - >(), |
161 |
| - get: vi.fn< |
162 |
| - ( |
163 |
| - driveId: string, |
164 |
| - optionalArgs?: Record<string, any>, |
165 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
166 |
| - >(), |
167 |
| - hide: vi.fn< |
168 |
| - (driveId: string) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
169 |
| - >(), |
170 |
| - list: vi.fn< |
171 |
| - ( |
172 |
| - optionalArgs?: Record<string, any>, |
173 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.DriveList |
174 |
| - >(), |
175 |
| - remove: |
176 |
| - vi.fn<(driveId: string, optionalArgs?: Record<string, any>) => void>(), |
177 |
| - unhide: |
178 |
| - vi.fn< |
179 |
| - (driveId: string) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
180 |
| - >(), |
181 |
| - update: |
182 |
| - vi.fn< |
183 |
| - ( |
184 |
| - resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive, |
185 |
| - driveId: string, |
186 |
| - optionalArgs?: Record<string, any>, |
187 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
188 |
| - >(), |
189 |
| - }; |
190 |
| -} |
191 |
| - |
192 |
| -export function mockedFilesCollection(): GoogleAppsScript.Drive_v3.Drive.V3.Collection.FilesCollection { |
193 |
| - return { |
194 |
| - copy: vi.fn< |
195 |
| - ( |
196 |
| - resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.File, |
197 |
| - fileId: string, |
198 |
| - optionalArgs?: Record<string, any>, |
199 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.File |
200 |
| - >(), |
201 |
| - create: |
202 |
| - vi.fn< |
203 |
| - ( |
204 |
| - resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.File, |
205 |
| - mediaData?: GoogleAppsScript.Base.Blob, |
206 |
| - optionalArgs?: Record<string, any>, |
207 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.File |
208 |
| - >(), |
209 |
| - download: |
210 |
| - vi.fn< |
211 |
| - ( |
212 |
| - fileId: string, |
213 |
| - optionalArgs?: Record<string, any>, |
214 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Operation |
215 |
| - >(), |
216 |
| - emptyTrash: vi.fn<(optionalArgs?: Record<string, any>) => void>(), |
217 |
| - export: vi.fn<(fileId: string, mimeType: string) => void>(), |
218 |
| - generateIds: |
219 |
| - vi.fn< |
220 |
| - ( |
221 |
| - optionalArgs?: Record<string, any>, |
222 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.GeneratedIds |
223 |
| - >(), |
224 |
| - get: vi.fn() as { |
225 |
| - ( |
226 |
| - fileId: string, |
227 |
| - optionalArgs?: Record<string, any> & { alt: "media" }, |
228 |
| - ): string; |
229 |
| - ( |
230 |
| - fileId: string, |
231 |
| - optionalArgs?: Record<string, any>, |
232 |
| - ): GoogleAppsScript.Drive_v3.Drive.V3.Schema.File; |
233 |
| - }, |
234 |
| - list: vi.fn< |
235 |
| - ( |
236 |
| - optionalArgs?: Record<string, any>, |
237 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.FileList |
238 |
| - >(), |
239 |
| - listLabels: |
240 |
| - vi.fn< |
241 |
| - ( |
242 |
| - fileId: string, |
243 |
| - optionalArgs?: Record<string, any>, |
244 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.LabelList |
245 |
| - >(), |
246 |
| - modifyLabels: |
247 |
| - vi.fn< |
248 |
| - ( |
249 |
| - resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.ModifyLabelsRequest, |
250 |
| - fileId: string, |
251 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.ModifyLabelsResponse |
252 |
| - >(), |
253 |
| - remove: |
254 |
| - vi.fn<(fileId: string, optionalArgs?: Record<string, any>) => void>(), |
255 |
| - update: |
256 |
| - vi.fn< |
257 |
| - ( |
258 |
| - resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.File, |
259 |
| - fileId: string, |
260 |
| - mediaData?: GoogleAppsScript.Base.Blob, |
261 |
| - optionalArgs?: Record<string, any>, |
262 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.File |
263 |
| - >(), |
264 |
| - watch: |
265 |
| - vi.fn< |
266 |
| - ( |
267 |
| - resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Channel, |
268 |
| - fileId: string, |
269 |
| - optionalArgs?: Record<string, any>, |
270 |
| - ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Channel |
271 |
| - >(), |
272 |
| - }; |
273 |
| -} |
274 |
| - |
275 | 120 | export function mockedHtmlOutput(): GoogleAppsScript.HTML.HtmlOutput {
|
276 | 121 | return {
|
277 | 122 | addMetaTag:
|
@@ -602,6 +447,163 @@ function mockedChannelsCollection(): GoogleAppsScript.Drive_v3.Drive.V3.Collecti
|
602 | 447 | };
|
603 | 448 | }
|
604 | 449 |
|
| 450 | +function mockedCommentsCollection(): GoogleAppsScript.Drive_v3.Drive.V3.Collection.CommentsCollection { |
| 451 | + return { |
| 452 | + create: |
| 453 | + vi.fn< |
| 454 | + ( |
| 455 | + resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment, |
| 456 | + fileId: string, |
| 457 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment |
| 458 | + >(), |
| 459 | + get: vi.fn< |
| 460 | + ( |
| 461 | + fileId: string, |
| 462 | + commentId: string, |
| 463 | + optionalArgs?: Record<string, any>, |
| 464 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment |
| 465 | + >(), |
| 466 | + list: vi.fn< |
| 467 | + ( |
| 468 | + fileId: string, |
| 469 | + optionalArgs?: Record<string, any>, |
| 470 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.CommentList |
| 471 | + >(), |
| 472 | + remove: vi.fn<(fileId: string, commentId: string) => void>(), |
| 473 | + update: |
| 474 | + vi.fn< |
| 475 | + ( |
| 476 | + resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment, |
| 477 | + fileId: string, |
| 478 | + commentId: string, |
| 479 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Comment |
| 480 | + >(), |
| 481 | + }; |
| 482 | +} |
| 483 | + |
| 484 | +function mockedDrivesCollection(): GoogleAppsScript.Drive_v3.Drive.V3.Collection.DrivesCollection { |
| 485 | + return { |
| 486 | + create: |
| 487 | + vi.fn< |
| 488 | + ( |
| 489 | + resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive, |
| 490 | + requestId: string, |
| 491 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
| 492 | + >(), |
| 493 | + get: vi.fn< |
| 494 | + ( |
| 495 | + driveId: string, |
| 496 | + optionalArgs?: Record<string, any>, |
| 497 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
| 498 | + >(), |
| 499 | + hide: vi.fn< |
| 500 | + (driveId: string) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
| 501 | + >(), |
| 502 | + list: vi.fn< |
| 503 | + ( |
| 504 | + optionalArgs?: Record<string, any>, |
| 505 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.DriveList |
| 506 | + >(), |
| 507 | + remove: |
| 508 | + vi.fn<(driveId: string, optionalArgs?: Record<string, any>) => void>(), |
| 509 | + unhide: |
| 510 | + vi.fn< |
| 511 | + (driveId: string) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
| 512 | + >(), |
| 513 | + update: |
| 514 | + vi.fn< |
| 515 | + ( |
| 516 | + resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive, |
| 517 | + driveId: string, |
| 518 | + optionalArgs?: Record<string, any>, |
| 519 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Drive |
| 520 | + >(), |
| 521 | + }; |
| 522 | +} |
| 523 | + |
| 524 | +function mockedFilesCollection(): GoogleAppsScript.Drive_v3.Drive.V3.Collection.FilesCollection { |
| 525 | + return { |
| 526 | + copy: vi.fn< |
| 527 | + ( |
| 528 | + resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.File, |
| 529 | + fileId: string, |
| 530 | + optionalArgs?: Record<string, any>, |
| 531 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.File |
| 532 | + >(), |
| 533 | + create: |
| 534 | + vi.fn< |
| 535 | + ( |
| 536 | + resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.File, |
| 537 | + mediaData?: GoogleAppsScript.Base.Blob, |
| 538 | + optionalArgs?: Record<string, any>, |
| 539 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.File |
| 540 | + >(), |
| 541 | + download: |
| 542 | + vi.fn< |
| 543 | + ( |
| 544 | + fileId: string, |
| 545 | + optionalArgs?: Record<string, any>, |
| 546 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Operation |
| 547 | + >(), |
| 548 | + emptyTrash: vi.fn<(optionalArgs?: Record<string, any>) => void>(), |
| 549 | + export: vi.fn<(fileId: string, mimeType: string) => void>(), |
| 550 | + generateIds: |
| 551 | + vi.fn< |
| 552 | + ( |
| 553 | + optionalArgs?: Record<string, any>, |
| 554 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.GeneratedIds |
| 555 | + >(), |
| 556 | + get: vi.fn() as { |
| 557 | + ( |
| 558 | + fileId: string, |
| 559 | + optionalArgs?: Record<string, any> & { alt: "media" }, |
| 560 | + ): string; |
| 561 | + ( |
| 562 | + fileId: string, |
| 563 | + optionalArgs?: Record<string, any>, |
| 564 | + ): GoogleAppsScript.Drive_v3.Drive.V3.Schema.File; |
| 565 | + }, |
| 566 | + list: vi.fn< |
| 567 | + ( |
| 568 | + optionalArgs?: Record<string, any>, |
| 569 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.FileList |
| 570 | + >(), |
| 571 | + listLabels: |
| 572 | + vi.fn< |
| 573 | + ( |
| 574 | + fileId: string, |
| 575 | + optionalArgs?: Record<string, any>, |
| 576 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.LabelList |
| 577 | + >(), |
| 578 | + modifyLabels: |
| 579 | + vi.fn< |
| 580 | + ( |
| 581 | + resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.ModifyLabelsRequest, |
| 582 | + fileId: string, |
| 583 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.ModifyLabelsResponse |
| 584 | + >(), |
| 585 | + remove: |
| 586 | + vi.fn<(fileId: string, optionalArgs?: Record<string, any>) => void>(), |
| 587 | + update: |
| 588 | + vi.fn< |
| 589 | + ( |
| 590 | + resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.File, |
| 591 | + fileId: string, |
| 592 | + mediaData?: GoogleAppsScript.Base.Blob, |
| 593 | + optionalArgs?: Record<string, any>, |
| 594 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.File |
| 595 | + >(), |
| 596 | + watch: |
| 597 | + vi.fn< |
| 598 | + ( |
| 599 | + resource: GoogleAppsScript.Drive_v3.Drive.V3.Schema.Channel, |
| 600 | + fileId: string, |
| 601 | + optionalArgs?: Record<string, any>, |
| 602 | + ) => GoogleAppsScript.Drive_v3.Drive.V3.Schema.Channel |
| 603 | + >(), |
| 604 | + }; |
| 605 | +} |
| 606 | + |
605 | 607 | function mockedOperationCollection(): GoogleAppsScript.Drive_v3.Drive.V3.Collection.OperationCollection {
|
606 | 608 | return {
|
607 | 609 | cancel: vi.fn<(name: string) => void>(),
|
@@ -723,3 +725,5 @@ function mockedTeamdrivesCollection(): GoogleAppsScript.Drive_v3.Drive.V3.Collec
|
723 | 725 | >(),
|
724 | 726 | };
|
725 | 727 | }
|
| 728 | + |
| 729 | +/* eslint-enable */ |
0 commit comments