Skip to content

Commit

Permalink
Merge pull request #1863 from skaut/gas-type-updates
Browse files Browse the repository at this point in the history
Updated GAS types
  • Loading branch information
marekdedic authored Dec 26, 2024
2 parents 3d7f3fb + 61d647b commit 6e10e74
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
5 changes: 1 addition & 4 deletions __tests__/backend/utils/DriveBackedValue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,7 @@ test("DriveBackedValue loads a value - the folder exists, the value exists", ()
],
};
const driveServiceMock = mockedSafeDriveService();
driveServiceMock.Files.get.mockReturnValueOnce(
// Incorrect upstream typings, string is actually permissible
JSON.stringify("VALUE") as unknown as GoogleAppsScript.Drive.Schema.File,
);
driveServiceMock.Files.get.mockReturnValueOnce(JSON.stringify("VALUE"));
driveServiceMock.Files.list
.mockReturnValueOnce(response1)
.mockReturnValueOnce(response2);
Expand Down
13 changes: 12 additions & 1 deletion __tests__/test-utils/gas-stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,18 @@ export function mockedFilesCollection(): GoogleAppsScript.Drive.Collection.Files
emptyTrash: jest.fn<() => void>(),
export: jest.fn<(fileId: string, mimeType: string) => void>(),
generateIds: jest.fn<() => GoogleAppsScript.Drive.Schema.GeneratedIds>(),
get: jest.fn<(fileId: string) => GoogleAppsScript.Drive.Schema.File>(),
get: jest.fn() as {
(
fileId: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- From upstream types
optionalArgs?: Record<string, any> & { alt: "media" },
): string;
(
fileId: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- From upstream types
optionalArgs?: Record<string, any>,
): GoogleAppsScript.Drive.Schema.File;
},
insert:
jest.fn<
(
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@smui/linear-progress": "^7.0.0",
"@smui/list": "^7.0.0",
"@smui/top-app-bar": "^7.0.0",
"@types/google-apps-script": "^1.0.86",
"@types/google-apps-script": "^1.0.89",
"@types/google.script.client-side": "^0.1.5",
"@types/jest": "^29.5.14",
"@types/node": "^22.9.3",
Expand Down

0 comments on commit 6e10e74

Please sign in to comment.