Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0c603fd
PLU-428 [FIND-MULTIPLE-ROWS-1]: Tiles (#899)
kevinkim-ogp May 30, 2025
c3bfaed
PLU-429 [FIND-MULTIPLE-ROWS-2]: M365 Excel (#900)
kevinkim-ogp Jun 2, 2025
7bc3aef
PLU-444 [FIND-MULTIPLE-ROWS-3]: Show test step output in table (#923)
kevinkim-ogp Jun 2, 2025
a913577
PLU-487 [FIND-MULTIPLE-ROWS-4]: Get Tiles column values dynamically (…
kevinkim-ogp Jun 5, 2025
154b099
PLU-488 [FIND-MULTIPLE-ROWS-5]: Get Excel column values dynamically (…
kevinkim-ogp Jun 5, 2025
93debc6
[FIND-MULTIPLE-ROWS-6] PLU-490 : Refactor output to common table type…
kevinkim-ogp Jul 11, 2025
2c45d95
[FIND-MULTIPLE-ROWS-7]: Update to multirow-multicol (#1065)
kevinkim-ogp Jul 11, 2025
58f6b13
[FOR-EACH-1]: Add for-each action to toolbox (#1035)
kevinkim-ogp Jul 11, 2025
407383d
[FOR-EACH-2] PLU-446: Add for-each steps in Editor (#1036)
kevinkim-ogp Jul 12, 2025
216066d
[FOR-EACH-2.5]: RTE select one variable only (#1059)
kevinkim-ogp Jul 12, 2025
7be9557
[FOR-EACH-3]: Delete for-each group and steps (#1037)
kevinkim-ogp Jul 12, 2025
454ff3e
[FOR-EACH-3.5]: Refactor if-then branch deletion (#1038)
kevinkim-ogp Jul 12, 2025
529277f
[FOR-EACH-4]: Create variables from input (#1040)
kevinkim-ogp Jul 12, 2025
0bec212
[FOR-EACH-5] PLU-447: Execute actions within for-each (#1045)
kevinkim-ogp Jul 14, 2025
a627746
[FOR-EACH-6] PLU-461: Executions page (#1049)
kevinkim-ogp Jul 14, 2025
7926832
[FOR-EACH-7]: Bulk retry failed iterations (#1056)
kevinkim-ogp Jul 14, 2025
b6b414d
[FOR-EACH-9]: Template for for-each (#1060)
kevinkim-ogp Jul 14, 2025
1121566
chore: use step name in suggestions popover (#1067)
kevinkim-ogp Jul 14, 2025
5d53a0a
feat: new badge for actions (#1088)
kevinkim-ogp Jul 14, 2025
aa030b6
chore: mark iteration as partial success (#1089)
kevinkim-ogp Jul 14, 2025
ac067d5
chore: allow variable replacement in single select mode (#1090)
kevinkim-ogp Jul 14, 2025
0a3c062
fix: handle zero values properly (#1093)
kevinkim-ogp Jul 14, 2025
b694124
fix: missing default metadata at processAction (#1100)
kevinkim-ogp Jul 17, 2025
26b95a3
chore: use flag to show/hide reminder templates (#1105)
kevinkim-ogp Jul 17, 2025
f3de847
chore: convert import to js for plumber admin (#1104)
kevinkim-ogp Jul 17, 2025
2d5768a
PLU-422: For-each BETA (#1098)
kevinkim-ogp Jul 17, 2025
d1908b8
v1.46.0
kevinkim-ogp Jul 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 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 packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
"tsconfig-paths": "^4.2.0",
"type-fest": "4.10.3"
},
"version": "1.45.3"
"version": "1.46.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import { IExecutionStep } from '@plumber/types'

import { describe, expect, it, vi } from 'vitest'

import { FOR_EACH_INPUT_SOURCE } from '@/apps/toolbox/common/constants'

import getDataOutMetadata from '../../actions/get-table-rows/get-data-out-metadata'

const DEFAULT_SUCCESS_EXECUTION_STEP = {
dataOut: {
rowsFound: 2,
data: {
rows: [
{
data: {
'436f6c756d6e31': 'value1',
'436f6c756d6e32': 'value2',
},
},
{
data: {
'436f6c756d6e31': 'value3',
'436f6c756d6e32': 'value4',
},
},
],
columns: [
{
id: '436f6c756d6e31',
name: 'Column1',
value: `data.rows.*.${Buffer.from('Column1').toString('hex')}`,
},
{
id: '436f6c756d6e32',
name: 'Column2',
value: `data.rows.*.${Buffer.from('Column2').toString('hex')}`,
},
],
inputSource: FOR_EACH_INPUT_SOURCE.M365_EXCEL,
},
},
} as unknown as IExecutionStep

describe('getTableRows getDataOutMetadata', () => {
it('should return null if no dataOut is provided', async () => {
const executionStep = { dataOut: null } as unknown as IExecutionStep
const result = await getDataOutMetadata(executionStep)
expect(result).toBeNull()
})

it('should return metadata for 0 rows found', async () => {
const executionStep = {
dataOut: {
rowsFound: 0,
data: {
rows: [],
columns: [
{
id: '436f6c756d6e31',
name: 'Column1',
value: `data.rows.*.${Buffer.from('Column1').toString('hex')}`,
},
],
inputSource: FOR_EACH_INPUT_SOURCE.M365_EXCEL,
},
},
} as unknown as IExecutionStep
const result = await getDataOutMetadata(executionStep)

expect(result).toEqual({
rowsFound: {
label: 'Number of rows found',
order: 2,
},
data: {
label: 'Row(s) found',
displayedValue: 'Preview 0 row(s)',
order: 1,
type: 'table',
},
})
})

it('should return metadata for foundRows: true with row data', async () => {
const result = await getDataOutMetadata(DEFAULT_SUCCESS_EXECUTION_STEP)

expect(result).toEqual({
rowsFound: {
label: 'Number of rows found',
order: 2,
},
data: {
label: 'Row(s) found',
displayedValue: 'Preview 2 row(s)',
order: 1,
type: 'table',
},
})
})

it('should handle missing columns in dataOut', async () => {
const executionStep = {
dataOut: {
rowsFound: 0,
data: {
rows: [],
// columns is missing
},
},
} as unknown as IExecutionStep

await expect(getDataOutMetadata(executionStep)).rejects.toThrow()
})

it('should handle invalid dataOut format gracefully', async () => {
// This test verifies that the function doesn't throw when dataOut doesn't match the schema
// In a real scenario, the zod schema would throw, but we're testing the error handling
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(vi.fn())

const executionStep = {
dataOut: {
// Missing the required rowsFound field
someOtherField: true,
},
} as unknown as IExecutionStep

// The function should throw when parsing invalid dataOut
await expect(getDataOutMetadata(executionStep)).rejects.toThrow()

consoleSpy.mockRestore()
})
})
Loading
Loading