test(Gmail Node): Add tests for Gmail node v1 (no-changelog) (#12461)

This commit is contained in:
Elias Meire
2025-03-14 18:13:12 +01:00
committed by GitHub
parent 86b791167a
commit 5670449025
12 changed files with 1650 additions and 62 deletions

View File

@@ -5,9 +5,7 @@ import {
type IDataObject,
type IExecuteFunctions,
type IHttpRequestMethods,
type ILoadOptionsFunctions,
type INodeExecutionData,
type INodePropertyOptions,
type INodeType,
type INodeTypeBaseDescription,
type INodeTypeDescription,
@@ -17,6 +15,7 @@ import { oldVersionNotice } from '@utils/descriptions';
import { draftFields, draftOperations } from './DraftDescription';
import { labelFields, labelOperations } from './LabelDescription';
import { getLabels } from './loadOptions';
import { messageFields, messageOperations } from './MessageDescription';
import { messageLabelFields, messageLabelOperations } from './MessageLabelDescription';
import type { IEmail } from '../../../../utils/sendAndWait/interfaces';
@@ -141,32 +140,7 @@ export class GmailV1 implements INodeType {
methods = {
loadOptions: {
// Get all the labels to display them to user so that they can
// select them easily
async getLabels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const labels = await googleApiRequestAllItems.call(
this,
'labels',
'GET',
'/gmail/v1/users/me/labels',
);
for (const label of labels) {
returnData.push({
name: label.name,
value: label.id,
});
}
return returnData.sort((a, b) => {
if (a.name < b.name) {
return -1;
}
if (a.name > b.name) {
return 1;
}
return 0;
});
},
getLabels,
},
};