@agility/management-sdk 0.1.33 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/api-coverage.md +217 -0
- package/.cursor/github-actions-improvements.md +76 -0
- package/.cursor/hardening.md +271 -0
- package/.cursor/linting-fix.md +160 -0
- package/.cursor/mocks.md +100 -0
- package/.cursor/test-coverage.md +841 -0
- package/README.md +87 -315
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/coverage-summary.json +43 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +161 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +161 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/apiClient.ts.html +199 -0
- package/coverage/lcov-report/src/apiMethods/assetMethods.ts.html +682 -0
- package/coverage/lcov-report/src/apiMethods/batchMethods.ts.html +736 -0
- package/coverage/lcov-report/src/apiMethods/clientInstance.ts.html +403 -0
- package/coverage/lcov-report/src/apiMethods/containerMethods.ts.html +460 -0
- package/coverage/lcov-report/src/apiMethods/contentMethods.ts.html +1183 -0
- package/coverage/lcov-report/src/apiMethods/index.html +266 -0
- package/coverage/lcov-report/src/apiMethods/instanceMethods.ts.html +160 -0
- package/coverage/lcov-report/src/apiMethods/instanceUserMethods.ts.html +268 -0
- package/coverage/lcov-report/src/apiMethods/modelMethods.ts.html +352 -0
- package/coverage/lcov-report/src/apiMethods/pageMethods.ts.html +1276 -0
- package/coverage/lcov-report/src/apiMethods/serverUserMethods.ts.html +196 -0
- package/coverage/lcov-report/src/apiMethods/webhookMethods.ts.html +271 -0
- package/coverage/lcov-report/src/enums/batchItemType.ts.html +106 -0
- package/coverage/lcov-report/src/enums/batchOperationType.ts.html +142 -0
- package/coverage/lcov-report/src/enums/batchState..ts.html +106 -0
- package/coverage/lcov-report/src/enums/index.html +161 -0
- package/coverage/lcov-report/src/enums/workflowOperationType.ts.html +175 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/models/assetContainer.ts.html +106 -0
- package/coverage/lcov-report/src/models/assetGalleries.ts.html +103 -0
- package/coverage/lcov-report/src/models/assetMediaGrouping.ts.html +136 -0
- package/coverage/lcov-report/src/models/assetMediaGroupingMetaData.ts.html +97 -0
- package/coverage/lcov-report/src/models/batch.ts.html +178 -0
- package/coverage/lcov-report/src/models/batchItem.ts.html +127 -0
- package/coverage/lcov-report/src/models/container.ts.html +232 -0
- package/coverage/lcov-report/src/models/contentDefinitionTypeID.ts.html +142 -0
- package/coverage/lcov-report/src/models/contentItem.ts.html +202 -0
- package/coverage/lcov-report/src/models/contentSectionDefaultModule.ts.html +106 -0
- package/coverage/lcov-report/src/models/contentSectionDefinition.ts.html +196 -0
- package/coverage/lcov-report/src/models/contentViewColumn.ts.html +109 -0
- package/coverage/lcov-report/src/models/exception.ts.html +109 -0
- package/coverage/lcov-report/src/models/index.html +476 -0
- package/coverage/lcov-report/src/models/instanceRole.ts.html +106 -0
- package/coverage/lcov-report/src/models/instanceUser.ts.html +130 -0
- package/coverage/lcov-report/src/models/locales.ts.html +100 -0
- package/coverage/lcov-report/src/models/media.ts.html +178 -0
- package/coverage/lcov-report/src/models/model.ts.html +172 -0
- package/coverage/lcov-report/src/models/notification.ts.html +124 -0
- package/coverage/lcov-report/src/models/options.ts.html +109 -0
- package/coverage/lcov-report/src/models/pageItem.ts.html +268 -0
- package/coverage/lcov-report/src/models/pageModel.ts.html +130 -0
- package/coverage/lcov-report/src/models/sharedModule.ts.html +106 -0
- package/coverage/lcov-report/src/models/sitemap.ts.html +148 -0
- package/coverage/lcov-report/src/models/websiteUser.ts.html +157 -0
- package/coverage/lcov.info +1459 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/coverage/src/apiClient.ts.html +199 -0
- package/coverage/src/apiMethods/assetMethods.ts.html +682 -0
- package/coverage/src/apiMethods/batchMethods.ts.html +736 -0
- package/coverage/src/apiMethods/clientInstance.ts.html +403 -0
- package/coverage/src/apiMethods/containerMethods.ts.html +460 -0
- package/coverage/src/apiMethods/contentMethods.ts.html +1183 -0
- package/coverage/src/apiMethods/index.html +266 -0
- package/coverage/src/apiMethods/instanceMethods.ts.html +160 -0
- package/coverage/src/apiMethods/instanceUserMethods.ts.html +268 -0
- package/coverage/src/apiMethods/modelMethods.ts.html +352 -0
- package/coverage/src/apiMethods/pageMethods.ts.html +1276 -0
- package/coverage/src/apiMethods/serverUserMethods.ts.html +196 -0
- package/coverage/src/apiMethods/webhookMethods.ts.html +271 -0
- package/coverage/src/enums/batchItemType.ts.html +106 -0
- package/coverage/src/enums/batchOperationType.ts.html +142 -0
- package/coverage/src/enums/batchState..ts.html +106 -0
- package/coverage/src/enums/index.html +161 -0
- package/coverage/src/enums/workflowOperationType.ts.html +175 -0
- package/coverage/src/index.html +116 -0
- package/coverage/src/models/assetContainer.ts.html +106 -0
- package/coverage/src/models/assetGalleries.ts.html +103 -0
- package/coverage/src/models/assetMediaGrouping.ts.html +136 -0
- package/coverage/src/models/assetMediaGroupingMetaData.ts.html +97 -0
- package/coverage/src/models/batch.ts.html +178 -0
- package/coverage/src/models/batchItem.ts.html +127 -0
- package/coverage/src/models/container.ts.html +232 -0
- package/coverage/src/models/contentDefinitionTypeID.ts.html +142 -0
- package/coverage/src/models/contentItem.ts.html +202 -0
- package/coverage/src/models/contentSectionDefaultModule.ts.html +106 -0
- package/coverage/src/models/contentSectionDefinition.ts.html +196 -0
- package/coverage/src/models/contentViewColumn.ts.html +109 -0
- package/coverage/src/models/exception.ts.html +109 -0
- package/coverage/src/models/index.html +476 -0
- package/coverage/src/models/instanceRole.ts.html +106 -0
- package/coverage/src/models/instanceUser.ts.html +130 -0
- package/coverage/src/models/locales.ts.html +100 -0
- package/coverage/src/models/media.ts.html +178 -0
- package/coverage/src/models/model.ts.html +172 -0
- package/coverage/src/models/notification.ts.html +124 -0
- package/coverage/src/models/options.ts.html +109 -0
- package/coverage/src/models/pageItem.ts.html +268 -0
- package/coverage/src/models/pageModel.ts.html +130 -0
- package/coverage/src/models/sharedModule.ts.html +106 -0
- package/coverage/src/models/sitemap.ts.html +148 -0
- package/coverage/src/models/websiteUser.ts.html +157 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/apiClient.d.ts.map +1 -0
- package/dist/apiClient.js.map +1 -0
- package/dist/apiMethods/assetMethods.d.ts.map +1 -0
- package/dist/apiMethods/assetMethods.js.map +1 -0
- package/dist/apiMethods/batchMethods.d.ts.map +1 -0
- package/dist/apiMethods/batchMethods.js.map +1 -0
- package/dist/apiMethods/clientInstance.d.ts.map +1 -0
- package/dist/apiMethods/clientInstance.js.map +1 -0
- package/dist/apiMethods/containerMethods.d.ts.map +1 -0
- package/dist/apiMethods/containerMethods.js.map +1 -0
- package/dist/apiMethods/contentMethods.d.ts.map +1 -0
- package/dist/apiMethods/contentMethods.js.map +1 -0
- package/dist/apiMethods/instanceMethods.d.ts.map +1 -0
- package/dist/apiMethods/instanceMethods.js.map +1 -0
- package/dist/apiMethods/instanceUserMethods.d.ts.map +1 -0
- package/dist/apiMethods/instanceUserMethods.js.map +1 -0
- package/dist/apiMethods/modelMethods.d.ts.map +1 -0
- package/dist/apiMethods/modelMethods.js.map +1 -0
- package/dist/apiMethods/pageMethods.d.ts +2 -1
- package/dist/apiMethods/pageMethods.d.ts.map +1 -0
- package/dist/apiMethods/pageMethods.js +7 -1
- package/dist/apiMethods/pageMethods.js.map +1 -0
- package/dist/apiMethods/serverUserMethods.d.ts.map +1 -0
- package/dist/apiMethods/serverUserMethods.js.map +1 -0
- package/dist/apiMethods/webhookMethods.d.ts.map +1 -0
- package/dist/apiMethods/webhookMethods.js.map +1 -0
- package/dist/enums/assetGroupingType.d.ts.map +1 -0
- package/dist/enums/assetGroupingType.js.map +1 -0
- package/dist/enums/batchItemType.d.ts.map +1 -0
- package/dist/enums/batchItemType.js.map +1 -0
- package/dist/enums/batchOperationType.d.ts.map +1 -0
- package/dist/enums/batchOperationType.js.map +1 -0
- package/dist/enums/batchState..d.ts.map +1 -0
- package/dist/enums/batchState..js.map +1 -0
- package/dist/enums/pageItemTemplateType.d.ts.map +1 -0
- package/dist/enums/pageItemTemplateType.js.map +1 -0
- package/dist/enums/workflowOperationType.d.ts.map +1 -0
- package/dist/enums/workflowOperationType.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/models/assetContainer.d.ts.map +1 -0
- package/dist/models/assetContainer.js.map +1 -0
- package/dist/models/assetGalleries.d.ts.map +1 -0
- package/dist/models/assetGalleries.js.map +1 -0
- package/dist/models/assetMediaGrouping.d.ts.map +1 -0
- package/dist/models/assetMediaGrouping.js.map +1 -0
- package/dist/models/assetMediaGroupingMetaData.d.ts.map +1 -0
- package/dist/models/assetMediaGroupingMetaData.js.map +1 -0
- package/dist/models/batch.d.ts.map +1 -0
- package/dist/models/batch.js.map +1 -0
- package/dist/models/batchItem.d.ts.map +1 -0
- package/dist/models/batchItem.js.map +1 -0
- package/dist/models/batchTypes.d.ts.map +1 -0
- package/dist/models/batchTypes.js.map +1 -0
- package/dist/models/container.d.ts.map +1 -0
- package/dist/models/container.js.map +1 -0
- package/dist/models/contentDefinitionTypeID.d.ts.map +1 -0
- package/dist/models/contentDefinitionTypeID.js.map +1 -0
- package/dist/models/contentItem.d.ts.map +1 -0
- package/dist/models/contentItem.js.map +1 -0
- package/dist/models/contentItemHistory.d.ts.map +1 -0
- package/dist/models/contentItemHistory.js.map +1 -0
- package/dist/models/contentListFilterModel.d.ts.map +1 -0
- package/dist/models/contentListFilterModel.js.map +1 -0
- package/dist/models/contentSectionDefaultModule.d.ts.map +1 -0
- package/dist/models/contentSectionDefaultModule.js.map +1 -0
- package/dist/models/contentSectionDefinition.d.ts.map +1 -0
- package/dist/models/contentSectionDefinition.js.map +1 -0
- package/dist/models/contentViewColumn.d.ts.map +1 -0
- package/dist/models/contentViewColumn.js.map +1 -0
- package/dist/models/exception.d.ts.map +1 -0
- package/dist/models/exception.js.map +1 -0
- package/dist/models/instanceRole.d.ts.map +1 -0
- package/dist/models/instanceRole.js.map +1 -0
- package/dist/models/instanceUser.d.ts.map +1 -0
- package/dist/models/instanceUser.js.map +1 -0
- package/dist/models/itemComments.d.ts.map +1 -0
- package/dist/models/itemComments.js.map +1 -0
- package/dist/models/listParams.d.ts.map +1 -0
- package/dist/models/listParams.js.map +1 -0
- package/dist/models/locales.d.ts.map +1 -0
- package/dist/models/locales.js.map +1 -0
- package/dist/models/media.d.ts.map +1 -0
- package/dist/models/media.js.map +1 -0
- package/dist/models/model.d.ts.map +1 -0
- package/dist/models/model.js.map +1 -0
- package/dist/models/notification.d.ts.map +1 -0
- package/dist/models/notification.js.map +1 -0
- package/dist/models/options.d.ts.map +1 -0
- package/dist/models/options.js.map +1 -0
- package/dist/models/pageHistory.d.ts.map +1 -0
- package/dist/models/pageHistory.js.map +1 -0
- package/dist/models/pageItem.d.ts.map +1 -0
- package/dist/models/pageItem.js.map +1 -0
- package/dist/models/pageModel.d.ts.map +1 -0
- package/dist/models/pageModel.js.map +1 -0
- package/dist/models/serverUser.d.ts.map +1 -0
- package/dist/models/serverUser.js.map +1 -0
- package/dist/models/sharedModule.d.ts.map +1 -0
- package/dist/models/sharedModule.js.map +1 -0
- package/dist/models/sitemap.d.ts.map +1 -0
- package/dist/models/sitemap.js.map +1 -0
- package/dist/models/webhook.d.ts.map +1 -0
- package/dist/models/webhook.js.map +1 -0
- package/dist/models/websiteListing.d.ts.map +1 -0
- package/dist/models/websiteListing.js.map +1 -0
- package/dist/models/websiteUser.d.ts.map +1 -0
- package/dist/models/websiteUser.js.map +1 -0
- package/docs/asset-methods.md +382 -0
- package/docs/auth-component.md +361 -0
- package/docs/auth.md +594 -0
- package/docs/batch-methods.md +244 -0
- package/docs/cicd.md +607 -0
- package/docs/container-methods.md +268 -0
- package/docs/content-methods.md +423 -0
- package/docs/instance-methods.md +105 -0
- package/docs/instance-user-methods.md +231 -0
- package/docs/model-methods.md +434 -0
- package/docs/multi-instance-operations.md +192 -0
- package/docs/page-methods.md +671 -0
- package/docs/server-user-methods.md +280 -0
- package/docs/webhook-methods.md +452 -0
- package/package.json +1 -1
|
@@ -0,0 +1,841 @@
|
|
|
1
|
+
# Agility CMS Management SDK Test Coverage Plan
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This document outlines comprehensive test coverage for all API methods in the Agility CMS Management SDK. Tests will be integration tests that hit real endpoints without mocks to ensure full functionality.
|
|
5
|
+
|
|
6
|
+
## Test Environment Requirements
|
|
7
|
+
|
|
8
|
+
### Prerequisites
|
|
9
|
+
- Valid Agility CMS instance with management API access
|
|
10
|
+
- Test environment variables configured in `.env.test`:
|
|
11
|
+
- `AGILITY_PAT`: Valid Personal Access Token (PAT)
|
|
12
|
+
- `AGILITY_GUID`: Test instance GUID
|
|
13
|
+
- `AGILITY_WEBSITE`: Test website ID within the instance
|
|
14
|
+
- `AGILITY_LOCALES`: Comma-separated list of test locales (e.g., 'en-us,fr-ca')
|
|
15
|
+
- `AGILITY_BASE_URL`: API base URL (optional, defaults to production)
|
|
16
|
+
|
|
17
|
+
### Test Data Requirements
|
|
18
|
+
- Test content models with known reference names
|
|
19
|
+
- Test containers with predictable structures
|
|
20
|
+
- Test content items that can be safely modified/deleted
|
|
21
|
+
- Test assets in known folders
|
|
22
|
+
- Test user accounts with appropriate permissions
|
|
23
|
+
- Test webhooks that can be created/modified/deleted
|
|
24
|
+
|
|
25
|
+
## API Method Coverage
|
|
26
|
+
|
|
27
|
+
### 1. AssetMethods (`src/apiMethods/assetMethods.ts`)
|
|
28
|
+
|
|
29
|
+
#### Core Asset Operations
|
|
30
|
+
- [ ] **deleteFile(mediaID, guid)**
|
|
31
|
+
- ✅ Success: Delete existing test asset
|
|
32
|
+
- ❌ Error: Delete non-existent asset (404)
|
|
33
|
+
- ❌ Error: Unauthorized deletion (403)
|
|
34
|
+
|
|
35
|
+
- [ ] **moveFile(mediaID, newFolder, guid)**
|
|
36
|
+
- ✅ Success: Move asset to existing folder
|
|
37
|
+
- ✅ Success: Move asset with special characters in folder name
|
|
38
|
+
- ❌ Error: Move non-existent asset
|
|
39
|
+
- ❌ Error: Move to non-existent folder
|
|
40
|
+
|
|
41
|
+
- [ ] **getMediaList(pageSize, recordOffset, guid)**
|
|
42
|
+
- ✅ Success: Get first page with default page size
|
|
43
|
+
- ✅ Success: Get specific page with custom page size
|
|
44
|
+
- ✅ Success: Handle empty results
|
|
45
|
+
- ❌ Error: Invalid pagination parameters
|
|
46
|
+
|
|
47
|
+
- [ ] **getAssetByID(mediaID, guid)**
|
|
48
|
+
- ✅ Success: Get existing asset details
|
|
49
|
+
- ❌ Error: Get non-existent asset (404)
|
|
50
|
+
- ❌ Error: Unauthorized access (403)
|
|
51
|
+
|
|
52
|
+
- [ ] **getAssetByUrl(url, guid)**
|
|
53
|
+
- ✅ Success: Get asset by valid URL
|
|
54
|
+
- ❌ Error: Get asset by invalid URL
|
|
55
|
+
- ❌ Error: Get asset by non-existent URL
|
|
56
|
+
|
|
57
|
+
#### Gallery Operations
|
|
58
|
+
- [ ] **getGalleries(guid, search?, pageSize?, rowIndex?)**
|
|
59
|
+
- ✅ Success: Get all galleries
|
|
60
|
+
- ✅ Success: Search galleries with filter
|
|
61
|
+
- ✅ Success: Paginated gallery results
|
|
62
|
+
- ✅ Success: Handle empty search results
|
|
63
|
+
|
|
64
|
+
- [ ] **getGalleryById(guid, id)**
|
|
65
|
+
- ✅ Success: Get existing gallery
|
|
66
|
+
- ❌ Error: Get non-existent gallery (404)
|
|
67
|
+
|
|
68
|
+
- [ ] **getGalleryByName(guid, galleryName)**
|
|
69
|
+
- ✅ Success: Get gallery by valid name
|
|
70
|
+
- ❌ Error: Get gallery by non-existent name
|
|
71
|
+
|
|
72
|
+
- [ ] **saveGallery(guid, gallery)**
|
|
73
|
+
- ✅ Success: Create new gallery
|
|
74
|
+
- ✅ Success: Update existing gallery
|
|
75
|
+
- ❌ Error: Invalid gallery data
|
|
76
|
+
- ❌ Error: Duplicate gallery name
|
|
77
|
+
|
|
78
|
+
- [ ] **deleteGallery(guid, id)**
|
|
79
|
+
- ✅ Success: Delete existing gallery
|
|
80
|
+
- ❌ Error: Delete non-existent gallery
|
|
81
|
+
- ❌ Error: Delete gallery with assets
|
|
82
|
+
|
|
83
|
+
#### Container & Upload Operations
|
|
84
|
+
- [ ] **getDefaultContainer(guid)**
|
|
85
|
+
- ✅ Success: Get default asset container
|
|
86
|
+
- ❌ Error: No default container configured
|
|
87
|
+
|
|
88
|
+
- [ ] **upload(formData, agilityFolderPath, guid, groupingID?)**
|
|
89
|
+
- ✅ Success: Upload single file to root
|
|
90
|
+
- ✅ Success: Upload to specific folder
|
|
91
|
+
- ✅ Success: Upload to gallery (with groupingID)
|
|
92
|
+
- ✅ Success: Upload multiple files
|
|
93
|
+
- ❌ Error: Invalid file format
|
|
94
|
+
- ❌ Error: File too large
|
|
95
|
+
- ❌ Error: Invalid folder path
|
|
96
|
+
|
|
97
|
+
#### Folder Operations
|
|
98
|
+
- [ ] **createFolder(originKey, guid)**
|
|
99
|
+
- ✅ Success: Create new folder
|
|
100
|
+
- ❌ Error: Create duplicate folder
|
|
101
|
+
- ❌ Error: Invalid folder name
|
|
102
|
+
|
|
103
|
+
- [ ] **deleteFolder(originKey, guid, mediaID?)**
|
|
104
|
+
- ✅ Success: Delete empty folder
|
|
105
|
+
- ✅ Success: Delete folder with assets
|
|
106
|
+
- ❌ Error: Delete non-existent folder
|
|
107
|
+
|
|
108
|
+
- [ ] **renameFolder(folderName, newFolderName, guid, mediaID?)**
|
|
109
|
+
- ✅ Success: Rename existing folder
|
|
110
|
+
- ❌ Error: Rename to existing folder name
|
|
111
|
+
- ❌ Error: Rename non-existent folder
|
|
112
|
+
|
|
113
|
+
### 2. BatchMethods (`src/apiMethods/batchMethods.ts`)
|
|
114
|
+
|
|
115
|
+
#### Batch Retrieval & Types
|
|
116
|
+
- [ ] **getBatch(batchID, guid, expandItems?)**
|
|
117
|
+
- ✅ Success: Get batch with expanded items
|
|
118
|
+
- ✅ Success: Get batch without expanded items
|
|
119
|
+
- ❌ Error: Get non-existent batch (404)
|
|
120
|
+
|
|
121
|
+
- [ ] **getBatchTypes(guid)**
|
|
122
|
+
- ✅ Success: Get all batch enum types
|
|
123
|
+
- ✅ Validation: Verify enum structure and values
|
|
124
|
+
|
|
125
|
+
#### Batch Operations
|
|
126
|
+
- [ ] **publishBatch(batchID, guid, returnBatchId?)**
|
|
127
|
+
- ✅ Success: Publish batch and wait for completion
|
|
128
|
+
- ✅ Success: Publish batch and return immediately
|
|
129
|
+
- ❌ Error: Publish non-existent batch
|
|
130
|
+
- ❌ Error: Publish already published batch
|
|
131
|
+
|
|
132
|
+
- [ ] **unpublishBatch(batchID, guid, returnBatchId?)**
|
|
133
|
+
- ✅ Success: Unpublish batch and wait for completion
|
|
134
|
+
- ✅ Success: Unpublish batch and return immediately
|
|
135
|
+
- ❌ Error: Unpublish non-published batch
|
|
136
|
+
|
|
137
|
+
- [ ] **approveBatch(batchID, guid, returnBatchId?)**
|
|
138
|
+
- ✅ Success: Approve pending batch
|
|
139
|
+
- ❌ Error: Approve already approved batch
|
|
140
|
+
- ❌ Error: Approve batch without approval workflow
|
|
141
|
+
|
|
142
|
+
- [ ] **declineBatch(batchID, guid, returnBatchId?)**
|
|
143
|
+
- ✅ Success: Decline pending batch
|
|
144
|
+
- ❌ Error: Decline already processed batch
|
|
145
|
+
|
|
146
|
+
- [ ] **requestApprovalBatch(batchID, guid, returnBatchId?)**
|
|
147
|
+
- ✅ Success: Request approval for batch
|
|
148
|
+
- ❌ Error: Request approval for published batch
|
|
149
|
+
|
|
150
|
+
#### Utility Methods
|
|
151
|
+
- [ ] **Retry(method)** - Internal retry mechanism
|
|
152
|
+
- ✅ Success: Retry until batch completion
|
|
153
|
+
- ❌ Error: Timeout after max retries
|
|
154
|
+
- ❌ Error: Method throws unrecoverable error
|
|
155
|
+
|
|
156
|
+
- [ ] **delay(ms)** - Internal delay utility
|
|
157
|
+
- ✅ Success: Proper delay timing
|
|
158
|
+
|
|
159
|
+
### 3. ClientInstance (`src/apiMethods/clientInstance.ts`)
|
|
160
|
+
|
|
161
|
+
#### URL Determination
|
|
162
|
+
- [ ] **determineBaseUrl(guid)**
|
|
163
|
+
- ✅ Success: Development environment (guid with 'd')
|
|
164
|
+
- ✅ Success: Production environment (guid with 'u')
|
|
165
|
+
- ✅ Success: US2 environment (guid with 'us2')
|
|
166
|
+
- ✅ Success: Canada environment (guid with 'c')
|
|
167
|
+
- ✅ Success: Europe environment (guid with 'e')
|
|
168
|
+
- ✅ Success: Australia environment (guid with 'a')
|
|
169
|
+
- ✅ Success: Default fallback for unknown pattern
|
|
170
|
+
- ✅ Success: Override with custom baseUrl option
|
|
171
|
+
|
|
172
|
+
#### Axios Instance Creation
|
|
173
|
+
- [ ] **getInstance(guid)**
|
|
174
|
+
- ✅ Success: Create instance with correct base URL
|
|
175
|
+
- ✅ Success: Verify maxContentLength and maxBodyLength settings
|
|
176
|
+
|
|
177
|
+
- [ ] **getAxiosInstance(guid)**
|
|
178
|
+
- ✅ Success: Create server-level axios instance
|
|
179
|
+
- ✅ Success: Verify correct API version path
|
|
180
|
+
|
|
181
|
+
#### HTTP Methods
|
|
182
|
+
- [ ] **executeGet(apiPath, guid, token)**
|
|
183
|
+
- ✅ Success: GET request with valid token
|
|
184
|
+
- ❌ Error: GET request with invalid token (401)
|
|
185
|
+
- ❌ Error: GET request to non-existent endpoint (404)
|
|
186
|
+
|
|
187
|
+
- [ ] **executePost(apiPath, guid, token, data)**
|
|
188
|
+
- ✅ Success: POST request with valid data
|
|
189
|
+
- ❌ Error: POST request with invalid data (400)
|
|
190
|
+
- ❌ Error: POST request with invalid token (401)
|
|
191
|
+
|
|
192
|
+
- [ ] **executeDelete(apiPath, guid, token, data?)**
|
|
193
|
+
- ✅ Success: DELETE request without data
|
|
194
|
+
- ✅ Success: DELETE request with data
|
|
195
|
+
- ❌ Error: DELETE request with invalid token (401)
|
|
196
|
+
|
|
197
|
+
- [ ] **executeServerGet(apiPath, guid, token)**
|
|
198
|
+
- ✅ Success: Server-level GET request
|
|
199
|
+
- ❌ Error: Server-level request with invalid token
|
|
200
|
+
|
|
201
|
+
### 4. ContainerMethods (`src/apiMethods/containerMethods.ts`)
|
|
202
|
+
|
|
203
|
+
#### Container Retrieval
|
|
204
|
+
- [ ] **getContainerByID(id, guid)**
|
|
205
|
+
- ✅ Success: Get existing container by ID
|
|
206
|
+
- ❌ Error: Get non-existent container (404)
|
|
207
|
+
|
|
208
|
+
- [ ] **getContainersByModel(modelId, guid)**
|
|
209
|
+
- ✅ Success: Get containers for existing model
|
|
210
|
+
- ✅ Success: Handle empty results for model with no containers
|
|
211
|
+
- ❌ Error: Get containers for non-existent model
|
|
212
|
+
|
|
213
|
+
- [ ] **getContainerByReferenceName(referenceName, guid)**
|
|
214
|
+
- ✅ Success: Get existing container by reference name
|
|
215
|
+
- ✅ Success: Return null for non-existent container (404 handling)
|
|
216
|
+
- ❌ Error: Other errors (not 404) should throw
|
|
217
|
+
|
|
218
|
+
- [ ] **getContainerList(guid)**
|
|
219
|
+
- ✅ Success: Get all containers
|
|
220
|
+
- ✅ Success: Verify container structure and required fields
|
|
221
|
+
|
|
222
|
+
#### Container Security & Notifications
|
|
223
|
+
- [ ] **getContainerSecurity(id, guid)**
|
|
224
|
+
- ✅ Success: Get security settings for container
|
|
225
|
+
- ❌ Error: Get security for non-existent container
|
|
226
|
+
|
|
227
|
+
- [ ] **getNotificationList(id, guid)**
|
|
228
|
+
- ✅ Success: Get notifications for container
|
|
229
|
+
- ✅ Success: Handle empty notification list
|
|
230
|
+
- ❌ Error: Get notifications for non-existent container
|
|
231
|
+
|
|
232
|
+
#### Container Modification
|
|
233
|
+
- [ ] **saveContainer(container, guid, forceReferenceName?)**
|
|
234
|
+
- ✅ Success: Create new container
|
|
235
|
+
- ✅ Success: Update existing container
|
|
236
|
+
- ✅ Success: Force reference name update
|
|
237
|
+
- ❌ Error: Invalid container data
|
|
238
|
+
- ❌ Error: Duplicate reference name without force flag
|
|
239
|
+
|
|
240
|
+
- [ ] **deleteContainer(id, guid)**
|
|
241
|
+
- ✅ Success: Delete empty container
|
|
242
|
+
- ❌ Error: Delete container with content
|
|
243
|
+
- ❌ Error: Delete non-existent container
|
|
244
|
+
|
|
245
|
+
### 5. ContentMethods (`src/apiMethods/contentMethods.ts`)
|
|
246
|
+
|
|
247
|
+
#### Content Item Operations
|
|
248
|
+
- [ ] **getContentItem(contentID, guid, locale)**
|
|
249
|
+
- ✅ Success: Get existing content item
|
|
250
|
+
- ❌ Error: Get non-existent content item (404)
|
|
251
|
+
- ❌ Error: Get content item for invalid locale
|
|
252
|
+
|
|
253
|
+
- [ ] **saveContentItem(contentItem, guid, locale, returnBatchId?)**
|
|
254
|
+
- ✅ Success: Create new content item
|
|
255
|
+
- ✅ Success: Update existing content item
|
|
256
|
+
- ✅ Success: Return batch ID immediately
|
|
257
|
+
- ❌ Error: Invalid content data
|
|
258
|
+
- ❌ Error: Missing required fields
|
|
259
|
+
|
|
260
|
+
- [ ] **saveContentItems(contentItems, guid, locale, returnBatchId?)**
|
|
261
|
+
- ✅ Success: Bulk create content items
|
|
262
|
+
- ✅ Success: Bulk update content items
|
|
263
|
+
- ✅ Success: Mixed create/update operations
|
|
264
|
+
- ❌ Error: Invalid content array
|
|
265
|
+
- ❌ Error: Partial failure handling
|
|
266
|
+
|
|
267
|
+
#### Content Workflow Operations
|
|
268
|
+
- [ ] **publishContent(contentID, guid, locale, comments?, returnBatchId?)**
|
|
269
|
+
- ✅ Success: Publish approved content
|
|
270
|
+
- ✅ Success: Publish with comments
|
|
271
|
+
- ✅ Success: Return batch ID immediately
|
|
272
|
+
- ❌ Error: Publish non-existent content
|
|
273
|
+
- ❌ Error: Publish content without approval (if required)
|
|
274
|
+
|
|
275
|
+
- [ ] **unPublishContent(contentID, guid, locale, comments?, returnBatchId?)**
|
|
276
|
+
- ✅ Success: Unpublish published content
|
|
277
|
+
- ✅ Success: Unpublish with comments
|
|
278
|
+
- ❌ Error: Unpublish non-published content
|
|
279
|
+
|
|
280
|
+
- [ ] **contentRequestApproval(contentID, guid, locale, comments?, returnBatchId?)**
|
|
281
|
+
- ✅ Success: Request approval for content
|
|
282
|
+
- ✅ Success: Request approval with comments
|
|
283
|
+
- ❌ Error: Request approval for published content
|
|
284
|
+
|
|
285
|
+
- [ ] **approveContent(contentID, guid, locale, comments?, returnBatchId?)**
|
|
286
|
+
- ✅ Success: Approve pending content
|
|
287
|
+
- ✅ Success: Approve with comments
|
|
288
|
+
- ❌ Error: Approve already approved content
|
|
289
|
+
|
|
290
|
+
- [ ] **declineContent(contentID, guid, locale, comments?, returnBatchId?)**
|
|
291
|
+
- ✅ Success: Decline pending content
|
|
292
|
+
- ✅ Success: Decline with comments
|
|
293
|
+
- ❌ Error: Decline already processed content
|
|
294
|
+
|
|
295
|
+
- [ ] **deleteContent(contentID, guid, locale, comments?, returnBatchId?)**
|
|
296
|
+
- ✅ Success: Delete existing content
|
|
297
|
+
- ✅ Success: Delete with comments
|
|
298
|
+
- ❌ Error: Delete non-existent content
|
|
299
|
+
- ❌ Error: Delete published content (if restricted)
|
|
300
|
+
|
|
301
|
+
#### Content Listing & Filtering
|
|
302
|
+
- [ ] **getContentItems(referenceName, guid, locale, listParams)**
|
|
303
|
+
- ✅ Success: Get content with basic list params
|
|
304
|
+
- ✅ Success: Get content with sorting
|
|
305
|
+
- ✅ Success: Get content with filtering
|
|
306
|
+
- ✅ Success: Get content with pagination
|
|
307
|
+
- ❌ Error: Get content for non-existent container
|
|
308
|
+
|
|
309
|
+
- [ ] **getContentList(referenceName, guid, locale, listParams, filterObject?)**
|
|
310
|
+
- ✅ Success: Get content list without filter
|
|
311
|
+
- ✅ Success: Get content list with filter object
|
|
312
|
+
- ✅ Success: Get content list with showDeleted flag
|
|
313
|
+
- ✅ Success: Complex filtering scenarios
|
|
314
|
+
- ❌ Error: Invalid filter object
|
|
315
|
+
|
|
316
|
+
#### Content History & Comments
|
|
317
|
+
- [ ] **getContentHistory(locale, guid, contentID, take?, skip?)**
|
|
318
|
+
- ✅ Success: Get content history with default params
|
|
319
|
+
- ✅ Success: Get content history with pagination
|
|
320
|
+
- ✅ Success: Handle empty history
|
|
321
|
+
- ❌ Error: Get history for non-existent content
|
|
322
|
+
|
|
323
|
+
- [ ] **getContentComments(locale, guid, contentID, take?, skip?)**
|
|
324
|
+
- ✅ Success: Get content comments with default params
|
|
325
|
+
- ✅ Success: Get content comments with pagination
|
|
326
|
+
- ✅ Success: Handle empty comments
|
|
327
|
+
- ❌ Error: Get comments for non-existent content
|
|
328
|
+
|
|
329
|
+
### 6. InstanceMethods (`src/apiMethods/instanceMethods.ts`)
|
|
330
|
+
|
|
331
|
+
#### Locale Operations
|
|
332
|
+
- [ ] **getLocales(guid)**
|
|
333
|
+
- ✅ Success: Get all available locales
|
|
334
|
+
- ✅ Success: Verify locale structure (code, displayName, isActive)
|
|
335
|
+
- ❌ Error: Get locales with invalid credentials
|
|
336
|
+
|
|
337
|
+
### 7. InstanceUserMethods (`src/apiMethods/instanceUserMethods.ts`)
|
|
338
|
+
|
|
339
|
+
#### User Management
|
|
340
|
+
- [ ] **getUsers(guid)**
|
|
341
|
+
- ✅ Success: Get all instance users
|
|
342
|
+
- ✅ Success: Verify user structure and roles
|
|
343
|
+
- ❌ Error: Get users without proper permissions
|
|
344
|
+
|
|
345
|
+
- [ ] **saveUser(emailAddress, roles, guid, firstName?, lastName?)**
|
|
346
|
+
- ✅ Success: Create new user with required fields
|
|
347
|
+
- ✅ Success: Create user with optional fields
|
|
348
|
+
- ✅ Success: Update existing user roles
|
|
349
|
+
- ❌ Error: Create user with invalid email
|
|
350
|
+
- ❌ Error: Create user with invalid roles
|
|
351
|
+
- ❌ Error: Duplicate user creation
|
|
352
|
+
|
|
353
|
+
- [ ] **deleteUser(userId, guid)**
|
|
354
|
+
- ✅ Success: Delete existing user
|
|
355
|
+
- ❌ Error: Delete non-existent user
|
|
356
|
+
- ❌ Error: Delete user without proper permissions
|
|
357
|
+
|
|
358
|
+
### 8. ModelMethods (`src/apiMethods/modelMethods.ts`)
|
|
359
|
+
|
|
360
|
+
#### Model Retrieval
|
|
361
|
+
- [ ] **getContentModel(id, guid)**
|
|
362
|
+
- ✅ Success: Get existing content model by ID
|
|
363
|
+
- ❌ Error: Get non-existent model (404)
|
|
364
|
+
|
|
365
|
+
- [ ] **getModelByReferenceName(referenceName, guid)**
|
|
366
|
+
- ✅ Success: Get existing model by reference name
|
|
367
|
+
- ❌ Error: Get model by non-existent reference name
|
|
368
|
+
|
|
369
|
+
- [ ] **getContentModules(includeDefaults, guid, includeModules?)**
|
|
370
|
+
- ✅ Success: Get content modules with defaults
|
|
371
|
+
- ✅ Success: Get content modules without defaults
|
|
372
|
+
- ✅ Success: Get content modules with module details
|
|
373
|
+
- ✅ Success: Verify module structure and properties
|
|
374
|
+
|
|
375
|
+
- [ ] **getPageModules(includeDefault, guid)**
|
|
376
|
+
- ✅ Success: Get page modules with defaults
|
|
377
|
+
- ✅ Success: Get page modules without defaults
|
|
378
|
+
- ✅ Success: Verify page module structure
|
|
379
|
+
|
|
380
|
+
#### Model Modification
|
|
381
|
+
- [ ] **saveModel(model, guid)**
|
|
382
|
+
- ✅ Success: Create new model
|
|
383
|
+
- ✅ Success: Update existing model
|
|
384
|
+
- ❌ Error: Invalid model data
|
|
385
|
+
- ❌ Error: Duplicate model reference name
|
|
386
|
+
|
|
387
|
+
- [ ] **deleteModel(id, guid)**
|
|
388
|
+
- ✅ Success: Delete unused model
|
|
389
|
+
- ❌ Error: Delete model in use
|
|
390
|
+
- ❌ Error: Delete non-existent model
|
|
391
|
+
|
|
392
|
+
### 9. PageMethods (`src/apiMethods/pageMethods.ts`)
|
|
393
|
+
|
|
394
|
+
#### Sitemap & Templates
|
|
395
|
+
- [ ] **getSitemap(guid, locale)**
|
|
396
|
+
- ✅ Success: Get complete sitemap
|
|
397
|
+
- ✅ Success: Verify sitemap structure and hierarchy
|
|
398
|
+
- ❌ Error: Get sitemap for invalid locale
|
|
399
|
+
|
|
400
|
+
- [ ] **getPageTemplates(guid, locale, includeModuleZones, searchFilter?)**
|
|
401
|
+
- ✅ Success: Get all page templates
|
|
402
|
+
- ✅ Success: Get templates with module zones
|
|
403
|
+
- ✅ Success: Get templates with search filter
|
|
404
|
+
- ✅ Success: Handle empty search results
|
|
405
|
+
|
|
406
|
+
- [ ] **getPageTemplate(guid, locale, pageTemplateId)**
|
|
407
|
+
- ✅ Success: Get existing page template by ID
|
|
408
|
+
- ❌ Error: Get non-existent template (404)
|
|
409
|
+
|
|
410
|
+
- [ ] **getPageTemplateName(guid, locale, templateName)**
|
|
411
|
+
- ✅ Success: Get existing page template by name
|
|
412
|
+
- ❌ Error: Get template by non-existent name
|
|
413
|
+
|
|
414
|
+
- [ ] **getPageItemTemplates(guid, locale, id)**
|
|
415
|
+
- ✅ Success: Get page template items/sections
|
|
416
|
+
- ✅ Success: Verify section definition structure
|
|
417
|
+
- ❌ Error: Get items for non-existent template
|
|
418
|
+
|
|
419
|
+
#### Template Management
|
|
420
|
+
- [ ] **savePageTemplate(guid, locale, pageModel)**
|
|
421
|
+
- ✅ Success: Create new page template
|
|
422
|
+
- ✅ Success: Update existing page template
|
|
423
|
+
- ❌ Error: Invalid page template data
|
|
424
|
+
- ❌ Error: Duplicate template name
|
|
425
|
+
|
|
426
|
+
- [ ] **deletePageTemplate(guid, locale, pageTemplateId)**
|
|
427
|
+
- ✅ Success: Delete unused page template
|
|
428
|
+
- ❌ Error: Delete template in use
|
|
429
|
+
- ❌ Error: Delete non-existent template
|
|
430
|
+
|
|
431
|
+
#### Page Operations
|
|
432
|
+
- [ ] **getPage(pageID, guid, locale)**
|
|
433
|
+
- ✅ Success: Get existing page
|
|
434
|
+
- ❌ Error: Get non-existent page (404)
|
|
435
|
+
- ❌ Error: Get page for invalid locale
|
|
436
|
+
|
|
437
|
+
- [ ] **savePage(pageItem, guid, locale, parentPageID?, placeBeforePageItemID?, returnBatchId?, pageIDInOtherLocale?, otherLocale?)**
|
|
438
|
+
- ✅ Success: Create new page with minimal params
|
|
439
|
+
- ✅ Success: Create page with parent page
|
|
440
|
+
- ✅ Success: Create page with positioning
|
|
441
|
+
- ✅ Success: Create page with locale linking
|
|
442
|
+
- ✅ Success: Update existing page
|
|
443
|
+
- ❌ Error: Invalid page data
|
|
444
|
+
- ❌ Error: Invalid parent page ID
|
|
445
|
+
|
|
446
|
+
#### Page Workflow Operations
|
|
447
|
+
- [ ] **publishPage(pageID, guid, locale, comments?, returnBatchId?)**
|
|
448
|
+
- ✅ Success: Publish approved page
|
|
449
|
+
- ✅ Success: Publish with comments
|
|
450
|
+
- ❌ Error: Publish non-existent page
|
|
451
|
+
- ❌ Error: Publish page without approval (if required)
|
|
452
|
+
|
|
453
|
+
- [ ] **unPublishPage(pageID, guid, locale, comments?, returnBatchId?)**
|
|
454
|
+
- ✅ Success: Unpublish published page
|
|
455
|
+
- ✅ Success: Unpublish with comments
|
|
456
|
+
- ❌ Error: Unpublish non-published page
|
|
457
|
+
|
|
458
|
+
- [ ] **pageRequestApproval(pageID, guid, locale, comments?, returnBatchId?)**
|
|
459
|
+
- ✅ Success: Request approval for page
|
|
460
|
+
- ✅ Success: Request approval with comments
|
|
461
|
+
- ❌ Error: Request approval for published page
|
|
462
|
+
|
|
463
|
+
- [ ] **approvePage(pageID, guid, locale, comments?, returnBatchId?)**
|
|
464
|
+
- ✅ Success: Approve pending page
|
|
465
|
+
- ✅ Success: Approve with comments
|
|
466
|
+
- ❌ Error: Approve already approved page
|
|
467
|
+
|
|
468
|
+
- [ ] **declinePage(pageID, guid, locale, comments?, returnBatchId?)**
|
|
469
|
+
- ✅ Success: Decline pending page
|
|
470
|
+
- ✅ Success: Decline with comments
|
|
471
|
+
- ❌ Error: Decline already processed page
|
|
472
|
+
|
|
473
|
+
- [ ] **deletePage(pageID, guid, locale, comments?, returnBatchId?)**
|
|
474
|
+
- ✅ Success: Delete existing page
|
|
475
|
+
- ✅ Success: Delete with comments
|
|
476
|
+
- ❌ Error: Delete non-existent page
|
|
477
|
+
- ❌ Error: Delete published page (if restricted)
|
|
478
|
+
|
|
479
|
+
#### Page History & Comments
|
|
480
|
+
- [ ] **getPageHistory(locale, guid, pageID, take?, skip?)**
|
|
481
|
+
- ✅ Success: Get page history with default params
|
|
482
|
+
- ✅ Success: Get page history with pagination
|
|
483
|
+
- ✅ Success: Handle empty history
|
|
484
|
+
- ❌ Error: Get history for non-existent page
|
|
485
|
+
|
|
486
|
+
- [ ] **getPageComments(locale, guid, pageID, take?, skip?)**
|
|
487
|
+
- ✅ Success: Get page comments with default params
|
|
488
|
+
- ✅ Success: Get page comments with pagination
|
|
489
|
+
- ✅ Success: Handle empty comments
|
|
490
|
+
- ❌ Error: Get comments for non-existent page
|
|
491
|
+
|
|
492
|
+
### 10. ServerUserMethods (`src/apiMethods/serverUserMethods.ts`)
|
|
493
|
+
|
|
494
|
+
#### Server User Operations
|
|
495
|
+
- [ ] **me(guid)**
|
|
496
|
+
- ✅ Success: Get current user information
|
|
497
|
+
- ✅ Success: Verify user structure (id, email, permissions)
|
|
498
|
+
- ❌ Error: Get user info with invalid token
|
|
499
|
+
|
|
500
|
+
- [ ] **you(guid, serverUserID)**
|
|
501
|
+
- ✅ Success: Get specific user information
|
|
502
|
+
- ❌ Error: Get non-existent user
|
|
503
|
+
- ❌ Error: Get user without proper permissions
|
|
504
|
+
|
|
505
|
+
### 11. WebhookMethods (`src/apiMethods/webhookMethods.ts`)
|
|
506
|
+
|
|
507
|
+
#### Webhook Management
|
|
508
|
+
- [ ] **webhookList(guid, take?, token?)**
|
|
509
|
+
- ✅ Success: Get all webhooks with default params
|
|
510
|
+
- ✅ Success: Get webhooks with custom page size
|
|
511
|
+
- ✅ Success: Handle empty webhook list
|
|
512
|
+
|
|
513
|
+
- [ ] **getWebhook(guid, webhookID)**
|
|
514
|
+
- ✅ Success: Get existing webhook
|
|
515
|
+
- ❌ Error: Get non-existent webhook (404)
|
|
516
|
+
|
|
517
|
+
- [ ] **saveWebhook(guid, webhook)**
|
|
518
|
+
- ✅ Success: Create new webhook
|
|
519
|
+
- ✅ Success: Update existing webhook
|
|
520
|
+
- ❌ Error: Invalid webhook data
|
|
521
|
+
- ❌ Error: Duplicate webhook URL
|
|
522
|
+
|
|
523
|
+
- [ ] **deleteWebhook(guid, webhookID)**
|
|
524
|
+
- ✅ Success: Delete existing webhook
|
|
525
|
+
- ❌ Error: Delete non-existent webhook
|
|
526
|
+
|
|
527
|
+
## Integration Tests Overview
|
|
528
|
+
|
|
529
|
+
Integration tests validate that all Management API methods work correctly with real API endpoints. These tests ensure comprehensive coverage of SDK functionality without mocks.
|
|
530
|
+
|
|
531
|
+
## Test Organization Structure
|
|
532
|
+
|
|
533
|
+
### Test File Structure
|
|
534
|
+
```
|
|
535
|
+
tests/
|
|
536
|
+
├── integration/
|
|
537
|
+
│ ├── assets/
|
|
538
|
+
│ │ ├── assetMethods.test.ts
|
|
539
|
+
│ │ ├── galleries.test.ts
|
|
540
|
+
│ │ └── folders.test.ts
|
|
541
|
+
│ ├── batch/
|
|
542
|
+
│ │ ├── batchMethods.test.ts
|
|
543
|
+
│ │ └── batchWorkflow.test.ts
|
|
544
|
+
│ ├── content/
|
|
545
|
+
│ │ ├── contentMethods.test.ts
|
|
546
|
+
│ │ ├── contentWorkflow.test.ts
|
|
547
|
+
│ │ └── contentListing.test.ts
|
|
548
|
+
│ ├── pages/
|
|
549
|
+
│ │ ├── pageMethods.test.ts
|
|
550
|
+
│ │ ├── pageTemplates.test.ts
|
|
551
|
+
│ │ └── pageWorkflow.test.ts
|
|
552
|
+
│ ├── models/
|
|
553
|
+
│ │ └── modelMethods.test.ts
|
|
554
|
+
│ ├── containers/
|
|
555
|
+
│ │ └── containerMethods.test.ts
|
|
556
|
+
│ ├── users/
|
|
557
|
+
│ │ ├── instanceUserMethods.test.ts
|
|
558
|
+
│ │ └── serverUserMethods.test.ts
|
|
559
|
+
│ ├── webhooks/
|
|
560
|
+
│ │ └── webhookMethods.test.ts
|
|
561
|
+
│ ├── instance/
|
|
562
|
+
│ │ └── instanceMethods.test.ts
|
|
563
|
+
│ ├── client/
|
|
564
|
+
│ │ └── clientInstance.test.ts
|
|
565
|
+
├── utils/
|
|
566
|
+
│ ├── fixtures.ts # Test data fixtures
|
|
567
|
+
│ ├── testClient.ts # Test client setup
|
|
568
|
+
│ ├── cleanup.ts # Test cleanup utilities
|
|
569
|
+
│ └── dependencies.ts # Dependency management utilities
|
|
570
|
+
└── setup.ts # Global test setup
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
### Test Priority Levels
|
|
574
|
+
|
|
575
|
+
#### Priority 1 (Critical) - Dependency-Ordered Core Operations
|
|
576
|
+
**Creation Order**: Galleries → Assets → Models → Containers → Content → Templates → Pages
|
|
577
|
+
- Gallery CRUD operations
|
|
578
|
+
- Asset upload/delete operations
|
|
579
|
+
- Model CRUD operations
|
|
580
|
+
- Container CRUD operations
|
|
581
|
+
- Content item CRUD operations
|
|
582
|
+
- Page template CRUD operations
|
|
583
|
+
- Page CRUD operations
|
|
584
|
+
|
|
585
|
+
#### Priority 2 (High) - Workflow Operations
|
|
586
|
+
- Content workflow (publish/unpublish/approve/decline)
|
|
587
|
+
- Page workflow operations
|
|
588
|
+
- Batch operations and polling
|
|
589
|
+
|
|
590
|
+
#### Priority 3 (Medium) - Advanced Features & Integration
|
|
591
|
+
- Asset gallery management
|
|
592
|
+
- Folder operations
|
|
593
|
+
- Content filtering and search
|
|
594
|
+
- Page template management
|
|
595
|
+
- User management operations
|
|
596
|
+
- Webhook management
|
|
597
|
+
|
|
598
|
+
#### Priority 4 (Low) - Utility & Edge Cases
|
|
599
|
+
- Client instance URL determination
|
|
600
|
+
- Retry mechanisms
|
|
601
|
+
- Error handling edge cases
|
|
602
|
+
- Pagination edge cases
|
|
603
|
+
|
|
604
|
+
## Test Data Management
|
|
605
|
+
|
|
606
|
+
### Test Data Strategy
|
|
607
|
+
1. **Dedicated Test Content**: Create test-specific content models, containers, and content items
|
|
608
|
+
2. **Dependency-Aware Creation**: Create test data in dependency order to avoid conflicts
|
|
609
|
+
3. **Reverse-Order Cleanup**: Clean up test data in reverse dependency order
|
|
610
|
+
4. **Data Isolation**: Use unique identifiers (timestamps, UUIDs) to avoid conflicts
|
|
611
|
+
5. **Test Fixtures**: Create reusable test data fixtures for common scenarios
|
|
612
|
+
|
|
613
|
+
### Test Data Dependencies & Creation Order
|
|
614
|
+
|
|
615
|
+
The following dependency chain must be respected for test data creation:
|
|
616
|
+
|
|
617
|
+
1. **Galleries** → 2. **Assets** → 3. **Models** → 4. **Containers** → 5. **Content** → 6. **Templates** → 7. **Pages**
|
|
618
|
+
|
|
619
|
+
#### Creation Order Details:
|
|
620
|
+
1. **Galleries**: Create asset galleries first (no dependencies)
|
|
621
|
+
2. **Assets**: Upload assets to galleries and folders (depends on galleries)
|
|
622
|
+
3. **Models**: Create content and page models (no dependencies on assets)
|
|
623
|
+
4. **Containers**: Create containers using models (depends on models)
|
|
624
|
+
5. **Content**: Create content items in containers (depends on containers, may reference assets)
|
|
625
|
+
6. **Templates**: Create page templates using models (depends on models, may reference content)
|
|
626
|
+
7. **Pages**: Create pages using templates and content (depends on templates, containers, content)
|
|
627
|
+
|
|
628
|
+
#### Cleanup Order (Reverse):
|
|
629
|
+
7. **Pages** → 6. **Templates** → 5. **Content** → 4. **Containers** → 3. **Models** → 2. **Assets** → 1. **Galleries**
|
|
630
|
+
|
|
631
|
+
### Required Test Models
|
|
632
|
+
- **TestArticle**: Basic content model for content operations
|
|
633
|
+
- **TestPage**: Basic page model for page operations
|
|
634
|
+
- **TestContainer**: Container for testing container operations
|
|
635
|
+
- **TestGallery**: Asset gallery for testing gallery operations
|
|
636
|
+
- **TestPageTemplate**: Page template for testing page operations
|
|
637
|
+
|
|
638
|
+
### Environment-Specific Considerations
|
|
639
|
+
- **Development Environment**: Full test suite with create/delete operations
|
|
640
|
+
- **Staging Environment**: Read-only tests for critical operations
|
|
641
|
+
- **Production Environment**: No tests (safety measure)
|
|
642
|
+
|
|
643
|
+
## Implementation Guidelines
|
|
644
|
+
|
|
645
|
+
### Test Structure Standards
|
|
646
|
+
1. **Arrange-Act-Assert**: Clear test structure
|
|
647
|
+
2. **Descriptive Names**: Test names should clearly describe the scenario
|
|
648
|
+
3. **Error Testing**: Always test both success and error scenarios
|
|
649
|
+
4. **Dependency-Aware Cleanup**: Ensure proper cleanup of created test data in reverse dependency order
|
|
650
|
+
5. **Retry Logic**: Implement retry logic for flaky network operations and CDN propagation
|
|
651
|
+
6. **CDN Propagation Handling**: Account for CDN propagation delays with appropriate timeouts
|
|
652
|
+
|
|
653
|
+
### Dependency Management Implementation
|
|
654
|
+
|
|
655
|
+
#### Test Data Creation Strategy
|
|
656
|
+
```typescript
|
|
657
|
+
class TestDataManager {
|
|
658
|
+
private createdData: {
|
|
659
|
+
galleries: number[];
|
|
660
|
+
assets: number[];
|
|
661
|
+
models: number[];
|
|
662
|
+
containers: number[];
|
|
663
|
+
content: number[];
|
|
664
|
+
templates: number[];
|
|
665
|
+
pages: number[];
|
|
666
|
+
} = {
|
|
667
|
+
galleries: [],
|
|
668
|
+
assets: [],
|
|
669
|
+
models: [],
|
|
670
|
+
containers: [],
|
|
671
|
+
content: [],
|
|
672
|
+
templates: [],
|
|
673
|
+
pages: []
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
// Create test data in dependency order
|
|
677
|
+
async setupTestData(): Promise<void> {
|
|
678
|
+
// 1. Create galleries
|
|
679
|
+
const gallery = await this.createTestGallery();
|
|
680
|
+
this.createdData.galleries.push(gallery.id);
|
|
681
|
+
|
|
682
|
+
// 2. Upload assets (depends on galleries)
|
|
683
|
+
const asset = await this.uploadTestAsset(gallery.id);
|
|
684
|
+
this.createdData.assets.push(asset.mediaID);
|
|
685
|
+
|
|
686
|
+
// 3. Create models (no dependencies)
|
|
687
|
+
const model = await this.createTestModel();
|
|
688
|
+
this.createdData.models.push(model.id);
|
|
689
|
+
|
|
690
|
+
// 4. Create containers (depends on models)
|
|
691
|
+
const container = await this.createTestContainer(model.id);
|
|
692
|
+
this.createdData.containers.push(container.id);
|
|
693
|
+
|
|
694
|
+
// 5. Create content (depends on containers, may reference assets)
|
|
695
|
+
const content = await this.createTestContent(container.id, asset.url);
|
|
696
|
+
this.createdData.content.push(content.id);
|
|
697
|
+
|
|
698
|
+
// 6. Create templates (depends on models)
|
|
699
|
+
const template = await this.createTestTemplate(model.id);
|
|
700
|
+
this.createdData.templates.push(template.id);
|
|
701
|
+
|
|
702
|
+
// 7. Create pages (depends on templates, containers, content)
|
|
703
|
+
const page = await this.createTestPage(template.id, content.id);
|
|
704
|
+
this.createdData.pages.push(page.id);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// Clean up test data in reverse dependency order
|
|
708
|
+
async cleanupTestData(): Promise<void> {
|
|
709
|
+
try {
|
|
710
|
+
// 7. Delete pages first
|
|
711
|
+
for (const pageId of this.createdData.pages) {
|
|
712
|
+
await this.deleteTestPage(pageId);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// 6. Delete templates
|
|
716
|
+
for (const templateId of this.createdData.templates) {
|
|
717
|
+
await this.deleteTestTemplate(templateId);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// 5. Delete content
|
|
721
|
+
for (const contentId of this.createdData.content) {
|
|
722
|
+
await this.deleteTestContent(contentId);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// 4. Delete containers
|
|
726
|
+
for (const containerId of this.createdData.containers) {
|
|
727
|
+
await this.deleteTestContainer(containerId);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// 3. Delete models
|
|
731
|
+
for (const modelId of this.createdData.models) {
|
|
732
|
+
await this.deleteTestModel(modelId);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// 2. Delete assets
|
|
736
|
+
for (const assetId of this.createdData.assets) {
|
|
737
|
+
await this.deleteTestAsset(assetId);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// 1. Delete galleries last
|
|
741
|
+
for (const galleryId of this.createdData.galleries) {
|
|
742
|
+
await this.deleteTestGallery(galleryId);
|
|
743
|
+
}
|
|
744
|
+
} catch (error) {
|
|
745
|
+
console.error('Cleanup failed:', error);
|
|
746
|
+
// Continue cleanup even if some items fail
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
#### CDN Test Implementation
|
|
753
|
+
```typescript
|
|
754
|
+
class CDNValidator {
|
|
755
|
+
private config: CDNTestConfig;
|
|
756
|
+
private fetchClient: any; // Agility Fetch API client
|
|
757
|
+
|
|
758
|
+
async validateContentOnCDN(contentId: number, locale: string): Promise<boolean> {
|
|
759
|
+
// Wait for CDN propagation with exponential backoff
|
|
760
|
+
const maxAttempts = 10;
|
|
761
|
+
const baseDelay = 2000; // 2 seconds
|
|
762
|
+
|
|
763
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
764
|
+
try {
|
|
765
|
+
const cdnContent = await this.fetchClient.getContentItem({
|
|
766
|
+
contentID: contentId,
|
|
767
|
+
locale: locale
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
if (cdnContent) {
|
|
771
|
+
return await this.validateContentStructure(cdnContent);
|
|
772
|
+
}
|
|
773
|
+
} catch (error) {
|
|
774
|
+
if (attempt === maxAttempts) {
|
|
775
|
+
throw new Error(`Content ${contentId} not available on CDN after ${maxAttempts} attempts`);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// Exponential backoff
|
|
779
|
+
const delay = baseDelay * Math.pow(2, attempt - 1);
|
|
780
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
return false;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
async validatePageOnCDN(pageId: number, locale: string): Promise<boolean> {
|
|
788
|
+
// Similar implementation for pages
|
|
789
|
+
// Include validation of page structure, modules, and content
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
async validateAssetOnCDN(assetUrl: string): Promise<boolean> {
|
|
793
|
+
try {
|
|
794
|
+
const response = await fetch(assetUrl);
|
|
795
|
+
return response.ok;
|
|
796
|
+
} catch (error) {
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
### Performance Considerations
|
|
804
|
+
1. **Rate Limiting**: Implement delays between tests to respect API rate limits
|
|
805
|
+
2. **Dependency-Aware Parallel Execution**: Group tests by dependency level for safe parallel execution
|
|
806
|
+
3. **CDN Propagation Timeouts**: Set appropriate timeouts for CDN validation (30-60 seconds)
|
|
807
|
+
4. **Test Duration**: Account for CDN propagation in test duration estimates
|
|
808
|
+
5. **Resource Management**: Monitor API usage and CDN requests during test runs
|
|
809
|
+
6. **Batch Operations**: Use batch operations where possible to reduce API calls
|
|
810
|
+
|
|
811
|
+
### Coverage Metrics
|
|
812
|
+
- **Method Coverage**: 100% of public methods tested
|
|
813
|
+
- **Scenario Coverage**: Success, error, and edge cases covered
|
|
814
|
+
- **Parameter Coverage**: All parameter combinations tested
|
|
815
|
+
- **Integration Coverage**: End-to-end workflows tested
|
|
816
|
+
|
|
817
|
+
## Test Execution Strategy
|
|
818
|
+
|
|
819
|
+
### Test Suites
|
|
820
|
+
1. **Smoke Tests**: Quick validation of core functionality
|
|
821
|
+
2. **Regression Tests**: Full test suite for release validation
|
|
822
|
+
3. **Workflow Tests**: End-to-end business process validation
|
|
823
|
+
4. **Performance Tests**: API response time and throughput validation
|
|
824
|
+
|
|
825
|
+
### Continuous Integration
|
|
826
|
+
- Run smoke tests on every commit
|
|
827
|
+
- Run full test suite on pull requests
|
|
828
|
+
- Run regression tests on releases
|
|
829
|
+
- Monitor test performance and API health
|
|
830
|
+
|
|
831
|
+
## Success Criteria
|
|
832
|
+
- [ ] All 82 identified API methods have comprehensive test coverage
|
|
833
|
+
- [ ] All success scenarios are tested with real API calls
|
|
834
|
+
- [ ] All error scenarios are properly handled and tested
|
|
835
|
+
- [ ] **Dependency Management**: Test data creation and cleanup follows strict dependency order
|
|
836
|
+
- [ ] **End-to-End Flows**: Complete workflow operations are validated
|
|
837
|
+
- [ ] Test suite runs reliably in CI/CD environment with proper cleanup
|
|
838
|
+
- [ ] Test data is properly managed with zero test data leakage
|
|
839
|
+
- [ ] Test execution time is reasonable (< 30 minutes for full suite)
|
|
840
|
+
- [ ] Test results provide clear feedback on SDK functionality
|
|
841
|
+
- [ ] **Self-Cleaning Tests**: No manual intervention required for test data cleanup
|