fix(Google Drive Node): Create from text operation (#9185)
This commit is contained in:
@@ -11,7 +11,7 @@ jest.mock('../../../../v2/transport', () => {
|
||||
return {
|
||||
...originalModule,
|
||||
googleApiRequest: jest.fn(async function () {
|
||||
return {};
|
||||
return { id: 42 };
|
||||
}),
|
||||
};
|
||||
});
|
||||
@@ -69,23 +69,34 @@ describe('test GoogleDriveV2: file createFromText', () => {
|
||||
|
||||
await createFromText.execute.call(fakeExecuteFunction, 0);
|
||||
|
||||
expect(transport.googleApiRequest).toBeCalledTimes(1);
|
||||
expect(transport.googleApiRequest).toBeCalledTimes(2);
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledWith(
|
||||
'POST',
|
||||
'/upload/drive/v3/files',
|
||||
'\n\t\t\n--XXXXXX\t\t\nContent-Type: application/json; charset=UTF-8\t\t\n\n{"name":"helloDrive.txt","parents":["folderIDxxxxxx"],"mimeType":"text/plain","properties":{"prop1":"value1","prop2":"value2"},"appProperties":{"appKey1":"appValue1"}}\t\t\n--XXXXXX\t\t\nContent-Type: text/plain\t\t\nContent-Transfer-Encoding: base64\t\t\n\nhello drive!\t\t\n--XXXXXX--',
|
||||
expect.anything(), // Buffer of content goes here
|
||||
{ uploadType: 'media' },
|
||||
undefined,
|
||||
{ headers: { 'Content-Length': 12, 'Content-Type': 'text/plain' } },
|
||||
);
|
||||
expect(transport.googleApiRequest).toHaveBeenCalledWith(
|
||||
'PATCH',
|
||||
'/drive/v3/files/42',
|
||||
{
|
||||
appProperties: { appKey1: 'appValue1' },
|
||||
mimeType: 'text/plain',
|
||||
name: 'helloDrive.txt',
|
||||
properties: { prop1: 'value1', prop2: 'value2' },
|
||||
},
|
||||
{
|
||||
addParents: 'folderIDxxxxxx',
|
||||
corpora: 'allDrives',
|
||||
includeItemsFromAllDrives: true,
|
||||
keepRevisionForever: true,
|
||||
ocrLanguage: 'en',
|
||||
spaces: 'appDataFolder, drive',
|
||||
supportsAllDrives: true,
|
||||
uploadType: 'multipart',
|
||||
useContentAsIndexableText: true,
|
||||
},
|
||||
undefined,
|
||||
{ headers: { 'Content-Length': 12, 'Content-Type': 'multipart/related; boundary=XXXXXX' } },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user