mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
test(Gmail Node): Add tests for Gmail node v1 (no-changelog) (#12461)
This commit is contained in:
@@ -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,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user