mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
adds test setup with nock
This commit is contained in:
parent
487aa0822f
commit
477170174b
|
@ -90,6 +90,96 @@ describe('AwsSes Node', () => {
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
description: 'should URIencode params for sending email with template',
|
||||
input: {
|
||||
workflowData: {
|
||||
nodes: [
|
||||
{
|
||||
parameters: {},
|
||||
type: 'n8n-nodes-base.manualTrigger',
|
||||
typeVersion: 1,
|
||||
position: [-180, 520],
|
||||
id: '363e874a-9054-4a64-bc3f-786719dde626',
|
||||
name: "When clicking 'Test workflow'",
|
||||
},
|
||||
{
|
||||
parameters: {
|
||||
operation: 'sendTemplate',
|
||||
templateName: '=Template11',
|
||||
fromEmail: 'test+user@example.com',
|
||||
toAddresses: ['test+user@example.com'],
|
||||
templateDataUi: {
|
||||
templateDataValues: [
|
||||
{
|
||||
key: 'Name',
|
||||
value: '=Special. Characters @#$%^&*()_-',
|
||||
},
|
||||
],
|
||||
},
|
||||
additionalFields: {},
|
||||
},
|
||||
type: 'n8n-nodes-base.awsSes',
|
||||
typeVersion: 1,
|
||||
position: [60, 520],
|
||||
id: '13bbf4ef-8320-45d1-9210-61b62794a108',
|
||||
name: 'AWS SES4',
|
||||
credentials: {
|
||||
aws: {
|
||||
id: 'Nz0QZhzu3MvfK4TQ',
|
||||
name: 'AWS account',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
connections: {
|
||||
"When clicking 'Test workflow'": {
|
||||
main: [
|
||||
[
|
||||
{
|
||||
node: 'AWS SES4',
|
||||
type: NodeConnectionType.Main,
|
||||
index: 0,
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
output: {
|
||||
nodeExecutionOrder: ['Start'],
|
||||
nodeData: { 'AWS SES': [[{ json: { success: 'true' } }]] },
|
||||
},
|
||||
nock: {
|
||||
baseUrl: 'https://email.eu-central-1.amazonaws.com',
|
||||
mocks: [
|
||||
{
|
||||
method: 'post',
|
||||
path: '/',
|
||||
requestBody: (body: any) => {
|
||||
assert.deepEqual(qs.parse(body), {
|
||||
Action: 'SendTemplatedEmail',
|
||||
TemplateName: '=Template11',
|
||||
Source: encodeURIComponent('test+user@example.com'),
|
||||
Destination: {
|
||||
ToAddresses: [encodeURIComponent('test+user@example.com')],
|
||||
},
|
||||
TemplateData: encodeURIComponent(
|
||||
JSON.stringify({
|
||||
Name: '=Special. Characters @#$%^&*()_-',
|
||||
}),
|
||||
),
|
||||
});
|
||||
return true;
|
||||
},
|
||||
statusCode: 200,
|
||||
responseBody:
|
||||
'<SendTemplatedEmailResponse><success>true</success></SendTemplatedEmailResponse>',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const nodeTypes = Helpers.setup(tests);
|
||||
|
|
Loading…
Reference in a new issue