fix(Item List Output Parser Node): Fix number of items parameter issue (#11696)

This commit is contained in:
Eugene
2024-11-12 14:40:46 +01:00
committed by GitHub
parent a025848ec4
commit 01ebe9dd38
2 changed files with 25 additions and 5 deletions

View File

@@ -35,6 +35,7 @@ describe('OutputParserItemList', () => {
const { response } = await outputParser.supplyData.call(thisArg, 0);
expect(response).toBeInstanceOf(N8nItemListOutputParser);
expect((response as any).numberOfItems).toBe(3);
});
it('should create a parser with custom number of items', async () => {
@@ -50,6 +51,20 @@ describe('OutputParserItemList', () => {
expect((response as any).numberOfItems).toBe(5);
});
it('should create a parser with unlimited number of items', async () => {
thisArg.getNodeParameter.mockImplementation((parameterName) => {
if (parameterName === 'options') {
return { numberOfItems: -1 };
}
throw new ApplicationError('Not implemented');
});
const { response } = await outputParser.supplyData.call(thisArg, 0);
expect(response).toBeInstanceOf(N8nItemListOutputParser);
expect((response as any).numberOfItems).toBeUndefined();
});
it('should create a parser with custom separator', async () => {
thisArg.getNodeParameter.mockImplementation((parameterName) => {
if (parameterName === 'options') {