forked from n8n-io/n8n
-
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.
fix(AWS Comprehend Node): Add paired item support (n8n-io#10015)
Co-authored-by: Michael Kret <michael.kret@n8n.io>
- Loading branch information
1 parent
3b2d76e
commit 470d496
Showing
3 changed files
with
179 additions
and
8 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
42 changes: 42 additions & 0 deletions
42
packages/nodes-base/nodes/Aws/Comprehend/test/AwsComprehend.node.test.ts
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,42 @@ | ||
import nock from 'nock'; | ||
import { getWorkflowFilenames, initBinaryDataService, testWorkflows } from '@test/nodes/Helpers'; | ||
|
||
const workflows = getWorkflowFilenames(__dirname); | ||
|
||
describe('Test AWS Comprehend Node', () => { | ||
describe('Detect Language', () => { | ||
let mock: nock.Scope; | ||
const now = 1683028800000; | ||
const response = { | ||
Languages: [ | ||
{ | ||
LanguageCode: 'en', | ||
Score: 0.9774383902549744, | ||
}, | ||
{ | ||
LanguageCode: 'de', | ||
Score: 0.010717987082898617, | ||
}, | ||
], | ||
}; | ||
beforeAll(async () => { | ||
jest.useFakeTimers({ doNotFake: ['nextTick'], now }); | ||
|
||
await initBinaryDataService(); | ||
|
||
nock.disableNetConnect(); | ||
const baseUrl = 'https://comprehend.eu-central-1.amazonaws.com'; | ||
|
||
mock = nock(baseUrl); | ||
}); | ||
|
||
beforeEach(async () => { | ||
mock.post('/').reply(200, response); | ||
}); | ||
afterAll(() => { | ||
nock.restore(); | ||
}); | ||
|
||
testWorkflows(workflows); | ||
}); | ||
}); |
125 changes: 125 additions & 0 deletions
125
packages/nodes-base/nodes/Aws/Comprehend/test/AwsComprehendTestWorkflow.json
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,125 @@ | ||
{ | ||
"name": "node-aws-comprehend", | ||
"nodes": [ | ||
{ | ||
"parameters": {}, | ||
"id": "53b6020d-5aa2-435f-9ee1-407111c0e3ee", | ||
"name": "When clicking ‘Test workflow’", | ||
"type": "n8n-nodes-base.manualTrigger", | ||
"position": [ | ||
680, | ||
380 | ||
], | ||
"typeVersion": 1 | ||
}, | ||
{ | ||
"parameters": { | ||
"assignments": { | ||
"assignments": [ | ||
{ | ||
"id": "51b7eee5-8cc9-4e09-a2f4-65ffb3cc17f6", | ||
"name": "text", | ||
"value": "This is a test.", | ||
"type": "string" | ||
} | ||
] | ||
}, | ||
"options": {} | ||
}, | ||
"id": "b3beaf43-fe4c-43e1-a8cb-5a0740050611", | ||
"name": "Edit Fields", | ||
"type": "n8n-nodes-base.set", | ||
"typeVersion": 3.4, | ||
"position": [ | ||
900, | ||
380 | ||
] | ||
}, | ||
{ | ||
"parameters": { | ||
"text": "={{ $json.text }}" | ||
}, | ||
"id": "a6a8a24c-0e58-40e7-8bf4-13a56edc6264", | ||
"name": "AWS Comprehend", | ||
"type": "n8n-nodes-base.awsComprehend", | ||
"typeVersion": 1, | ||
"position": [ | ||
1100, | ||
380 | ||
], | ||
"credentials": { | ||
"aws": { | ||
"id": "TyNATsPCTvPF0tvG", | ||
"name": "AWS account" | ||
} | ||
} | ||
}, | ||
{ | ||
"parameters": {}, | ||
"id": "bfc4b84d-8cf1-4650-bf3c-2b1cdc677afc", | ||
"name": "No Operation, do nothing", | ||
"type": "n8n-nodes-base.noOp", | ||
"typeVersion": 1, | ||
"position": [ | ||
1320, | ||
380 | ||
] | ||
} | ||
], | ||
"pinData": { | ||
"No Operation, do nothing": [ | ||
{ | ||
"json": { | ||
"de": 0.010717987082898617, | ||
"en": 0.9774383902549744 | ||
} | ||
} | ||
] | ||
}, | ||
"connections": { | ||
"Edit Fields": { | ||
"main": [ | ||
[ | ||
{ | ||
"node": "AWS Comprehend", | ||
"type": "main", | ||
"index": 0 | ||
} | ||
] | ||
] | ||
}, | ||
"When clicking ‘Test workflow’": { | ||
"main": [ | ||
[ | ||
{ | ||
"node": "Edit Fields", | ||
"type": "main", | ||
"index": 0 | ||
} | ||
] | ||
] | ||
}, | ||
"AWS Comprehend": { | ||
"main": [ | ||
[ | ||
{ | ||
"node": "No Operation, do nothing", | ||
"type": "main", | ||
"index": 0 | ||
} | ||
] | ||
] | ||
} | ||
}, | ||
"active": false, | ||
"settings": { | ||
"executionOrder": "v1" | ||
}, | ||
"versionId": "eae3c601-56b8-42ec-a0b7-14df8d697043", | ||
"meta": { | ||
"templateCredsSetupCompleted": true, | ||
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd" | ||
}, | ||
"id": "fuOmKcLPWAxKi0bn", | ||
"tags": [] | ||
} |