Skip to content

Commit

Permalink
fix(Canvas): Valid otherwise and doFinally
Browse files Browse the repository at this point in the history
fix: #1674
  • Loading branch information
lordrip committed Dec 2, 2024
1 parent 4c19ab6 commit 78a9529
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ describe('CamelComponentDefaultService', () => {
expect(doTryDefault.doTry?.doCatch?.[0].exception).toHaveLength(1);
});

it('should return the default value for a otherwise processor', () => {
const otherwiseDefault = CamelComponentDefaultService.getDefaultNodeDefinitionValue({
type: 'processor',
name: 'otherwise',
} as DefinedComponent) as any;
expect(otherwiseDefault).toBeDefined();
expect(otherwiseDefault.steps[0].log).toBeDefined();
});

it('should return the default value for a doFinally processor', () => {
const doFinallyDefault = CamelComponentDefaultService.getDefaultNodeDefinitionValue({
type: 'processor',
name: 'doFinally',
} as DefinedComponent) as any;
expect(doFinallyDefault).toBeDefined();
expect(doFinallyDefault.steps[0].log).toBeDefined();
});

it('should return the default value for a log processor', () => {
const logDefault = CamelComponentDefaultService.getDefaultNodeDefinitionValue({
type: 'processor',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ export class CamelComponentDefaultService {
message: "\${body}"
`);

case 'otherwise':
case 'doFinally':
return parse(`
id: ${getCamelRandomId(processorName)}
steps:
- log:
id: ${getCamelRandomId('log')}
message: "\${body}"
`);

case 'log':
return parse(`
log:
Expand Down

0 comments on commit 78a9529

Please sign in to comment.