-
Notifications
You must be signed in to change notification settings - Fork 11
feat(assets): add updateValueById for PUT /odata/Assets({key}) #453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -77,7 +77,7 @@ describe.each(modes)('Orchestrator Assets - Integration Tests [%s]', (mode) => { | |||||
| expect(result.name).toBeDefined(); | ||||||
| expect(result.valueType).toBeDefined(); | ||||||
| expect(typeof result.name).toBe('string'); | ||||||
| }); | ||||||
| }); | ||||||
| }); | ||||||
|
|
||||||
| describe('getByName', () => { | ||||||
|
|
@@ -159,6 +159,42 @@ describe.each(modes)('Orchestrator Assets - Integration Tests [%s]', (mode) => { | |||||
| }); | ||||||
| }); | ||||||
|
|
||||||
| describe('updateValueById', () => { | ||||||
| it('should update an existing text asset and persist the change', async () => { | ||||||
| const { assets } = getServices(); | ||||||
| const config = getTestConfig(); | ||||||
|
|
||||||
| if (!config.folderId) { | ||||||
| throw new Error('INTEGRATION_TEST_FOLDER_ID must be configured to test updateValueById'); | ||||||
| } | ||||||
| const folderId = Number(config.folderId); | ||||||
|
|
||||||
| // Find an existing Text-type asset in the folder so we can update it safely | ||||||
| const allAssets = await assets.getAll({ | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OData filter values should use the camelCase field names shown in the SDK response, not PascalCase API field names. Per the conventions: "filter, select, expand, orderby values use the field case shown in the SDK response (camelCase for services that transform, else as-is) — not the raw API. Applies within JSDoc examples, tests, and internal calls."
Suggested change
|
||||||
| folderId, | ||||||
| pageSize: 20, | ||||||
| filter: "ValueType eq 'Text'", | ||||||
| }); | ||||||
|
|
||||||
| if (allAssets.items.length === 0) { | ||||||
| throw new Error('No Text-type assets available in the configured folder to exercise updateValueById'); | ||||||
| } | ||||||
|
|
||||||
| const target = allAssets.items[0]; | ||||||
| const previousValue = target.value ?? ''; | ||||||
| const newValue = `sdk-test-${Date.now()}`; | ||||||
|
|
||||||
| const result = await assets.updateValueById(target.id, newValue, { folderId }); | ||||||
| expect(result).toBeUndefined(); | ||||||
|
|
||||||
| const refreshed = await assets.getById(target.id, folderId); | ||||||
| expect(refreshed.value).toBe(newValue); | ||||||
|
|
||||||
| // Restore the asset so the suite is idempotent | ||||||
| await assets.updateValueById(target.id, previousValue, { folderId }); | ||||||
| }); | ||||||
| }); | ||||||
|
|
||||||
| describe('Asset structure validation', () => { | ||||||
| it('should have expected fields in asset objects', async () => { | ||||||
| const { assets } = getServices(); | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.