first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Azure Cosmos DB - Create Item', () => {
|
||||
beforeEach(() => {
|
||||
const { baseUrl } = credentials.microsoftAzureCosmosDbSharedKeyApi;
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/json' })
|
||||
.get('/colls/container1')
|
||||
.reply(200, {
|
||||
id: 'containerFromSDK',
|
||||
indexingPolicy: {
|
||||
indexingMode: 'consistent',
|
||||
automatic: true,
|
||||
includedPaths: [{ path: '/*' }],
|
||||
excludedPaths: [{ path: '/"_etag"/?' }],
|
||||
},
|
||||
partitionKey: {
|
||||
paths: ['/id'],
|
||||
kind: 'Hash',
|
||||
},
|
||||
conflictResolutionPolicy: {
|
||||
mode: 'LastWriterWins',
|
||||
conflictResolutionPath: '/_ts',
|
||||
conflictResolutionProcedure: '',
|
||||
},
|
||||
geospatialConfig: {
|
||||
type: 'Geography',
|
||||
},
|
||||
_rid: '4PVyAMLVz0c=',
|
||||
_ts: 1739178329,
|
||||
_self: 'dbs/4PVyAA==/colls/4PVyAMLVz0c=/',
|
||||
_etag: '"0000f905-0000-0300-0000-67a9c1590000"',
|
||||
_docs: 'docs/',
|
||||
_sprocs: 'sprocs/',
|
||||
_triggers: 'triggers/',
|
||||
_udfs: 'udfs/',
|
||||
_conflicts: 'conflicts/',
|
||||
})
|
||||
.post('/colls/container1/docs')
|
||||
.reply(201, {
|
||||
id: 'item1',
|
||||
_rid: '4PVyAMPuBtoEAAAAAAAAAA==',
|
||||
_self: 'dbs/4PVyAA==/colls/4PVyAMPuBto=/docs/4PVyAMPuBtoEAAAAAAAAAA==/',
|
||||
_etag: '"bb000143-0000-0300-0000-67d9a2430000"',
|
||||
_attachments: 'attachments/',
|
||||
_ts: 1742316099,
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['create.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "49466d78-738a-4dee-a2fb-2143f7800b45",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "create",
|
||||
"container": {
|
||||
"__rl": true,
|
||||
"value": "container1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "container1"
|
||||
},
|
||||
"customProperties": "{\n\t\"id\": \"item1\"\n}",
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.azureCosmosDb",
|
||||
"typeVersion": 1,
|
||||
"position": [220, 0],
|
||||
"id": "00d6b986-6b8a-43ee-a6a5-b6a7c165c991",
|
||||
"name": "Azure Cosmos Db",
|
||||
"credentials": {
|
||||
"microsoftAzureCosmosDbSharedKeyApi": {
|
||||
"id": "exampleId",
|
||||
"name": "Azure Cosmos DB account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Azure Cosmos Db",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Azure Cosmos Db": [
|
||||
{
|
||||
"json": {
|
||||
"id": "item1",
|
||||
"_rid": "4PVyAMPuBtoEAAAAAAAAAA==",
|
||||
"_self": "dbs/4PVyAA==/colls/4PVyAMPuBto=/docs/4PVyAMPuBtoEAAAAAAAAAA==/",
|
||||
"_etag": "\"bb000143-0000-0300-0000-67d9a2430000\"",
|
||||
"_attachments": "attachments/",
|
||||
"_ts": 1742316099
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Azure Cosmos DB - Delete Item', () => {
|
||||
beforeEach(() => {
|
||||
const { baseUrl } = credentials.microsoftAzureCosmosDbSharedKeyApi;
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/json' })
|
||||
.get('/colls/container1')
|
||||
.reply(200, {
|
||||
id: 'containerFromSDK',
|
||||
indexingPolicy: {
|
||||
indexingMode: 'consistent',
|
||||
automatic: true,
|
||||
includedPaths: [{ path: '/*' }],
|
||||
excludedPaths: [{ path: '/"_etag"/?' }],
|
||||
},
|
||||
partitionKey: {
|
||||
paths: ['/id'],
|
||||
kind: 'Hash',
|
||||
},
|
||||
conflictResolutionPolicy: {
|
||||
mode: 'LastWriterWins',
|
||||
conflictResolutionPath: '/_ts',
|
||||
conflictResolutionProcedure: '',
|
||||
},
|
||||
geospatialConfig: {
|
||||
type: 'Geography',
|
||||
},
|
||||
_rid: '4PVyAMLVz0c=',
|
||||
_ts: 1739178329,
|
||||
_self: 'dbs/4PVyAA==/colls/4PVyAMLVz0c=/',
|
||||
_etag: '"0000f905-0000-0300-0000-67a9c1590000"',
|
||||
_docs: 'docs/',
|
||||
_sprocs: 'sprocs/',
|
||||
_triggers: 'triggers/',
|
||||
_udfs: 'udfs/',
|
||||
_conflicts: 'conflicts/',
|
||||
})
|
||||
.delete('/colls/container1/docs/item1')
|
||||
.reply(204, '');
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['delete.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "49466d78-738a-4dee-a2fb-2143f7800b45",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "delete",
|
||||
"container": {
|
||||
"__rl": true,
|
||||
"value": "container1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "container1"
|
||||
},
|
||||
"item": {
|
||||
"__rl": true,
|
||||
"value": "item1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "item1"
|
||||
},
|
||||
"additionalFields": {},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.azureCosmosDb",
|
||||
"typeVersion": 1,
|
||||
"position": [220, 0],
|
||||
"id": "00d6b986-6b8a-43ee-a6a5-b6a7c165c991",
|
||||
"name": "Azure Cosmos Db",
|
||||
"credentials": {
|
||||
"microsoftAzureCosmosDbSharedKeyApi": {
|
||||
"id": "exampleId",
|
||||
"name": "Azure Cosmos DB account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Azure Cosmos Db",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Azure Cosmos Db": [
|
||||
{
|
||||
"json": {
|
||||
"deleted": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Azure Cosmos DB - Get Item', () => {
|
||||
beforeEach(() => {
|
||||
const { baseUrl } = credentials.microsoftAzureCosmosDbSharedKeyApi;
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/json' })
|
||||
.get('/colls/container1')
|
||||
.reply(200, {
|
||||
id: 'containerFromSDK',
|
||||
indexingPolicy: {
|
||||
indexingMode: 'consistent',
|
||||
automatic: true,
|
||||
includedPaths: [{ path: '/*' }],
|
||||
excludedPaths: [{ path: '/"_etag"/?' }],
|
||||
},
|
||||
partitionKey: {
|
||||
paths: ['/id'],
|
||||
kind: 'Hash',
|
||||
},
|
||||
conflictResolutionPolicy: {
|
||||
mode: 'LastWriterWins',
|
||||
conflictResolutionPath: '/_ts',
|
||||
conflictResolutionProcedure: '',
|
||||
},
|
||||
geospatialConfig: {
|
||||
type: 'Geography',
|
||||
},
|
||||
_rid: '4PVyAMLVz0c=',
|
||||
_ts: 1739178329,
|
||||
_self: 'dbs/4PVyAA==/colls/4PVyAMLVz0c=/',
|
||||
_etag: '"0000f905-0000-0300-0000-67a9c1590000"',
|
||||
_docs: 'docs/',
|
||||
_sprocs: 'sprocs/',
|
||||
_triggers: 'triggers/',
|
||||
_udfs: 'udfs/',
|
||||
_conflicts: 'conflicts/',
|
||||
})
|
||||
.get('/colls/container1/docs/item1')
|
||||
.matchHeader('x-ms-documentdb-partitionkey', '["item1"]')
|
||||
.reply(200, {
|
||||
id: 'item1',
|
||||
_rid: '4PVyAMPuBtoEAAAAAAAAAA==',
|
||||
_self: 'dbs/4PVyAA==/colls/4PVyAMPuBto=/docs/4PVyAMPuBtoEAAAAAAAAAA==/',
|
||||
_etag: '"bb000143-0000-0300-0000-67d9a2430000"',
|
||||
_attachments: 'attachments/',
|
||||
_ts: 1742316099,
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['get.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "49466d78-738a-4dee-a2fb-2143f7800b45",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "get",
|
||||
"container": {
|
||||
"__rl": true,
|
||||
"value": "container1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "container1"
|
||||
},
|
||||
"item": {
|
||||
"__rl": true,
|
||||
"value": "item1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "item1"
|
||||
},
|
||||
"additionalFields": {
|
||||
"partitionKey": "item1"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.azureCosmosDb",
|
||||
"typeVersion": 1,
|
||||
"position": [220, 0],
|
||||
"id": "00d6b986-6b8a-43ee-a6a5-b6a7c165c991",
|
||||
"name": "Azure Cosmos Db",
|
||||
"credentials": {
|
||||
"microsoftAzureCosmosDbSharedKeyApi": {
|
||||
"id": "exampleId",
|
||||
"name": "Azure Cosmos DB account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Azure Cosmos Db",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Azure Cosmos Db": [
|
||||
{
|
||||
"json": {
|
||||
"id": "item1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Azure Cosmos DB - Get All Items', () => {
|
||||
beforeEach(() => {
|
||||
const { baseUrl } = credentials.microsoftAzureCosmosDbSharedKeyApi;
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/json' })
|
||||
.get('/colls/newOne3/docs')
|
||||
.reply(
|
||||
200,
|
||||
{
|
||||
_rid: '4PVyAMPuBto=',
|
||||
Documents: [
|
||||
{
|
||||
id: 'John',
|
||||
FamilyName: 'NewNameAdded',
|
||||
Parents: [
|
||||
88,
|
||||
{ FirstName: 'Thomas', FamilyName: 'Bob' },
|
||||
{ FamilyName: null, FirstName: 'Mary Kay' },
|
||||
],
|
||||
ExtraField: 'nothing serious',
|
||||
Otherdetails: 'male',
|
||||
This: 'male',
|
||||
},
|
||||
{
|
||||
FamilyName: 'NewName',
|
||||
id: 'NewId',
|
||||
},
|
||||
{
|
||||
id: 'this',
|
||||
},
|
||||
],
|
||||
_count: 3,
|
||||
},
|
||||
{
|
||||
'x-ms-continuation': '4PVyAKoVaBQ=',
|
||||
},
|
||||
)
|
||||
.get('/colls/newOne3/docs')
|
||||
.matchHeader('x-ms-continuation', '4PVyAKoVaBQ=')
|
||||
.reply(200, {
|
||||
_rid: '4PVyAMPuBto=',
|
||||
Documents: [
|
||||
{
|
||||
id: 'John',
|
||||
FamilyName: 'NewNameAdded',
|
||||
Parents: [
|
||||
88,
|
||||
{ FirstName: 'Thomas', FamilyName: 'Bob' },
|
||||
{ FamilyName: null, FirstName: 'Mary Kay' },
|
||||
],
|
||||
ExtraField: 'nothing serious',
|
||||
Otherdetails: 'male',
|
||||
This: 'male',
|
||||
},
|
||||
],
|
||||
_count: 1,
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['getAll.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-180, -520],
|
||||
"id": "8218dacc-3b5f-460a-a773-817faf012ba9",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"container": {
|
||||
"__rl": true,
|
||||
"value": "newOne3",
|
||||
"mode": "list",
|
||||
"cachedResultName": "newOne3"
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.azureCosmosDb",
|
||||
"typeVersion": 1,
|
||||
"position": [-80, -360],
|
||||
"id": "4f60d430-3c90-4838-b9d1-8c9637e745b6",
|
||||
"name": "getAllItems",
|
||||
"alwaysOutputData": true,
|
||||
"credentials": {
|
||||
"microsoftAzureCosmosDbSharedKeyApi": {
|
||||
"id": "exampleId",
|
||||
"name": "Azure Cosmos DB account "
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "getAllItems",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"getAllItems": [
|
||||
{
|
||||
"json": {
|
||||
"id": "John",
|
||||
"FamilyName": "NewNameAdded",
|
||||
"Parents": [
|
||||
88,
|
||||
{
|
||||
"FirstName": "Thomas",
|
||||
"FamilyName": "Bob"
|
||||
},
|
||||
{
|
||||
"FamilyName": null,
|
||||
"FirstName": "Mary Kay"
|
||||
}
|
||||
],
|
||||
"ExtraField": "nothing serious",
|
||||
"Otherdetails": "male",
|
||||
"This": "male"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"FamilyName": "NewName",
|
||||
"id": "NewId"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"id": "this"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Azure Cosmos DB - Query Items', () => {
|
||||
beforeEach(() => {
|
||||
const { baseUrl } = credentials.microsoftAzureCosmosDbSharedKeyApi;
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/json' })
|
||||
.post('/colls/newId/docs', {
|
||||
query: 'SELECT * FROM c WHERE c.id = @Param1',
|
||||
parameters: [
|
||||
{
|
||||
name: '@Param1',
|
||||
value: 'User1',
|
||||
},
|
||||
],
|
||||
})
|
||||
.reply(200, {
|
||||
Documents: [
|
||||
{
|
||||
id: 'User1',
|
||||
key1: 'value',
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['query.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [-80, -100],
|
||||
"id": "7da2ce49-9a9d-4240-b082-ff1b12d101b1",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "query",
|
||||
"container": {
|
||||
"__rl": true,
|
||||
"value": "newId",
|
||||
"mode": "list",
|
||||
"cachedResultName": "newId"
|
||||
},
|
||||
"query": "SELECT * FROM c WHERE c.id = $1",
|
||||
"options": {
|
||||
"queryOptions": {
|
||||
"queryParameters": "User1"
|
||||
}
|
||||
},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.azureCosmosDb",
|
||||
"typeVersion": 1,
|
||||
"position": [160, -100],
|
||||
"id": "0dc90797-8211-457c-a673-b7df28139de8",
|
||||
"name": "queryItems",
|
||||
"retryOnFail": false,
|
||||
"alwaysOutputData": true,
|
||||
"credentials": {
|
||||
"microsoftAzureCosmosDbSharedKeyApi": {
|
||||
"id": "exampleId",
|
||||
"name": "Azure Cosmos DB account "
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "queryItems",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"queryItems": [
|
||||
{
|
||||
"json": {
|
||||
"id": "User1",
|
||||
"key1": "value"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
import { credentials } from '../credentials';
|
||||
|
||||
describe('Azure Cosmos DB - Update Item', () => {
|
||||
beforeEach(() => {
|
||||
const { baseUrl } = credentials.microsoftAzureCosmosDbSharedKeyApi;
|
||||
|
||||
nock(baseUrl)
|
||||
.persist()
|
||||
.defaultReplyHeaders({ 'Content-Type': 'application/json' })
|
||||
.get('/colls/container1')
|
||||
.reply(200, {
|
||||
id: 'containerFromSDK',
|
||||
indexingPolicy: {
|
||||
indexingMode: 'consistent',
|
||||
automatic: true,
|
||||
includedPaths: [{ path: '/*' }],
|
||||
excludedPaths: [{ path: '/"_etag"/?' }],
|
||||
},
|
||||
partitionKey: {
|
||||
paths: ['/id'],
|
||||
kind: 'Hash',
|
||||
},
|
||||
conflictResolutionPolicy: {
|
||||
mode: 'LastWriterWins',
|
||||
conflictResolutionPath: '/_ts',
|
||||
conflictResolutionProcedure: '',
|
||||
},
|
||||
geospatialConfig: {
|
||||
type: 'Geography',
|
||||
},
|
||||
_rid: '4PVyAMLVz0c=',
|
||||
_ts: 1739178329,
|
||||
_self: 'dbs/4PVyAA==/colls/4PVyAMLVz0c=/',
|
||||
_etag: '"0000f905-0000-0300-0000-67a9c1590000"',
|
||||
_docs: 'docs/',
|
||||
_sprocs: 'sprocs/',
|
||||
_triggers: 'triggers/',
|
||||
_udfs: 'udfs/',
|
||||
_conflicts: 'conflicts/',
|
||||
})
|
||||
.put('/colls/container1/docs/item1', {
|
||||
id: 'item1',
|
||||
key1: 'value1',
|
||||
})
|
||||
.matchHeader('x-ms-documentdb-partitionkey', '["item1"]')
|
||||
.reply(200, {
|
||||
id: 'item1',
|
||||
key1: 'value1',
|
||||
_rid: '4PVyAMPuBtoEAAAAAAAAAA==',
|
||||
_self: 'dbs/4PVyAA==/colls/4PVyAMPuBto=/docs/4PVyAMPuBtoEAAAAAAAAAA==/',
|
||||
_etag: '"bb002b70-0000-0300-0000-67d9a3c70000"',
|
||||
_attachments: 'attachments/',
|
||||
_ts: 1742316487,
|
||||
});
|
||||
});
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
credentials,
|
||||
workflowFiles: ['update.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [0, 0],
|
||||
"id": "49466d78-738a-4dee-a2fb-2143f7800b45",
|
||||
"name": "When clicking ‘Execute workflow’"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "item",
|
||||
"operation": "update",
|
||||
"container": {
|
||||
"__rl": true,
|
||||
"value": "container1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "container1"
|
||||
},
|
||||
"item": {
|
||||
"__rl": true,
|
||||
"value": "item1",
|
||||
"mode": "list",
|
||||
"cachedResultName": "item1"
|
||||
},
|
||||
"customProperties": "{\n \"key1\": \"value1\"\n}",
|
||||
"additionalFields": {},
|
||||
"requestOptions": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.azureCosmosDb",
|
||||
"typeVersion": 1,
|
||||
"position": [220, 0],
|
||||
"id": "00d6b986-6b8a-43ee-a6a5-b6a7c165c991",
|
||||
"name": "Azure Cosmos Db",
|
||||
"credentials": {
|
||||
"microsoftAzureCosmosDbSharedKeyApi": {
|
||||
"id": "exampleId",
|
||||
"name": "Azure Cosmos DB account"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Azure Cosmos Db",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"pinData": {
|
||||
"Azure Cosmos Db": [
|
||||
{
|
||||
"json": {
|
||||
"id": "item1",
|
||||
"key1": "value1",
|
||||
"_rid": "4PVyAMPuBtoEAAAAAAAAAA==",
|
||||
"_self": "dbs/4PVyAA==/colls/4PVyAMPuBto=/docs/4PVyAMPuBtoEAAAAAAAAAA==/",
|
||||
"_etag": "\"bb002b70-0000-0300-0000-67d9a3c70000\"",
|
||||
"_attachments": "attachments/",
|
||||
"_ts": 1742316487
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "7047d2700c0010a2580ba6b2649861ef0a567bfcd1671650a6ca242150e686b8"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user