mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
feat: Add token to sendAndWait operations links to walidate in webhook (#17566)
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user