forked from activepieces/activepieces
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request activepieces#2758 from activepieces/fix/for-loop-t…
…runcation fix: for loop truncation
- Loading branch information
Showing
4 changed files
with
88 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
ActionType, | ||
ExecutionOutput, | ||
ExecutionOutputStatus, | ||
ExecutionState, | ||
StepOutputStatus, | ||
} from '@activepieces/shared' | ||
import { loggingUtils } from '../../src/lib/helper/logging-utils' | ||
|
||
describe('Logging Utils', () => { | ||
it('Should not truncate whole step if its log size exceeds limit', async () => { | ||
// arrange | ||
const mockStepOutput = { | ||
type: ActionType.CODE, | ||
status: StepOutputStatus.SUCCEEDED, | ||
input: { | ||
a: 'a'.repeat(2197100), | ||
}, | ||
} | ||
|
||
const mockExecutionState = new ExecutionState() | ||
mockExecutionState.insertStep(mockStepOutput, 'mockStep', []) | ||
|
||
const mockExecutionOutput: ExecutionOutput = { | ||
status: ExecutionOutputStatus.SUCCEEDED, | ||
executionState: mockExecutionState, | ||
duration: 10, | ||
tasks: 10, | ||
} | ||
|
||
// act | ||
const result = await loggingUtils.trimExecution(mockExecutionOutput) | ||
|
||
// assert | ||
expect(result.executionState.steps['mockStep'].input).toHaveProperty<string>('a', '(truncated)') | ||
}) | ||
}) |