feat: Add token to sendAndWait operations links to walidate in webhook (#17566)

This commit is contained in:
Michael Kret
2025-08-06 17:28:50 +03:00
committed by GitHub
parent 6495e08c79
commit 9cb5754f33
30 changed files with 277 additions and 92 deletions

View File

@@ -62,25 +62,20 @@ describe('Send and Wait utils tests', () => {
return params[parameterName];
});
mockExecuteFunctions.evaluateExpression.mockImplementation((expression: string) => {
const expressions: { [key: string]: string } = {
'{{ $execution?.resumeUrl }}': 'http://localhost',
'{{ $nodeId }}': 'testNodeId',
};
return expressions[expression];
});
mockExecuteFunctions.getSignedResumeUrl.mockReturnValue(
'http://localhost/waiting-webhook/nodeID?approved=true&signature=abc',
);
const config = getSendAndWaitConfig(mockExecuteFunctions);
expect(config).toEqual({
appendAttribution: undefined,
title: 'Test subject',
message: 'Test message',
url: 'http://localhost/testNodeId',
options: [
{
label: 'Approve',
value: 'true',
style: 'primary',
url: 'http://localhost/waiting-webhook/nodeID?approved=true&signature=abc',
},
],
});
@@ -102,13 +97,12 @@ describe('Send and Wait utils tests', () => {
return params[parameterName];
});
mockExecuteFunctions.evaluateExpression.mockImplementation((expression: string) => {
const expressions: { [key: string]: string } = {
'{{ $execution?.resumeUrl }}': 'http://localhost',
'{{ $nodeId }}': 'testNodeId',
};
return expressions[expression];
});
mockExecuteFunctions.getSignedResumeUrl.mockReturnValueOnce(
'http://localhost/waiting-webhook/nodeID?approved=true&signature=abc',
);
mockExecuteFunctions.getSignedResumeUrl.mockReturnValueOnce(
'http://localhost/waiting-webhook/nodeID?approved=false&signature=abc',
);
const config = getSendAndWaitConfig(mockExecuteFunctions);
@@ -117,13 +111,13 @@ describe('Send and Wait utils tests', () => {
expect.arrayContaining([
{
label: 'Reject',
value: 'false',
style: 'secondary',
url: 'http://localhost/waiting-webhook/nodeID?approved=false&signature=abc',
},
{
label: 'Approve',
value: 'true',
style: 'primary',
url: 'http://localhost/waiting-webhook/nodeID?approved=true&signature=abc',
},
]),
);
@@ -146,13 +140,7 @@ describe('Send and Wait utils tests', () => {
return params[parameterName];
});
mockExecuteFunctions.evaluateExpression.mockImplementation((expression: string) => {
const expressions: { [key: string]: string } = {
'{{ $execution?.resumeUrl }}': 'http://localhost',
'{{ $nodeId }}': 'testNodeId',
};
return expressions[expression];
});
mockExecuteFunctions.getSignedResumeUrl.mockReturnValue('http://localhost/testNodeId');
});
it('should create a valid email object', () => {