-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARSN-392 Fix processVersionSpecificPut
- For backward compatibility (if isNull is undefined), add the nullVersionId field to the master update. The nullVersionId is needed for listing, retrieving, and deleting null versions. - For the new null key implementation (if isNull is defined): add the isNull2 field and set it to true to specify that the new version is null AND has been put with a Cloudserver handling null keys (i.e., supporting S3C-7352). - Manage scenarios in which a version is marked with the isNull attribute set to true, but without a version ID. This happens after BackbeatClient.putMetadata() is applied to a standalone null master.
- Loading branch information
1 parent
1653fd2
commit 5178536
Showing
4 changed files
with
414 additions
and
11 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
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
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,55 @@ | ||
const { Version } = require('../../../lib/versioning/Version'); | ||
|
||
describe('Version', () => { | ||
describe('appendVersionId', () => { | ||
it('should append versionId to an empty object', () => { | ||
const emptyObject = '{}'; | ||
const versionId = '123'; | ||
const expected = '{"versionId":"123"}'; | ||
const result = Version.appendVersionId(emptyObject, versionId); | ||
expect(result).toEqual(expected); | ||
}); | ||
|
||
it('should append versionId to an object with existing properties', () => { | ||
const existingObject = '{"key":"value"}'; | ||
const versionId = '456'; | ||
const expected = '{"key":"value","versionId":"456"}'; | ||
const result = Version.appendVersionId(existingObject, versionId); | ||
expect(result).toEqual(expected); | ||
}); | ||
|
||
it('should append versionId to an object with existing versionId', () => { | ||
const objectWithVersionId = '{"key":"value","versionId":"old"}'; | ||
const versionId = 'new'; | ||
const expected = '{"key":"value","versionId":"old","versionId":"new"}'; | ||
const result = Version.appendVersionId(objectWithVersionId, versionId); | ||
expect(result).toEqual(expected); | ||
}); | ||
}); | ||
|
||
describe('updateOrAppendNullVersionId', () => { | ||
it('should append nullVersionId when it does not exist', () => { | ||
const initialValue = '{"key":"value"}'; | ||
const nullVersionId = '12345'; | ||
const expectedValue = '{"key":"value","nullVersionId":"12345"}'; | ||
const result = Version.updateOrAppendNullVersionId(initialValue, nullVersionId); | ||
expect(result).toEqual(expectedValue); | ||
}); | ||
|
||
it('should update nullVersionId when it exists', () => { | ||
const initialValue = '{"key":"value","nullVersionId":"initial"}'; | ||
const nullVersionId = 'updated12345'; | ||
const expectedValue = '{"key":"value","nullVersionId":"updated12345"}'; | ||
const result = Version.updateOrAppendNullVersionId(initialValue, nullVersionId); | ||
expect(result).toEqual(expectedValue); | ||
}); | ||
|
||
it('should handle empty string by appending nullVersionId', () => { | ||
const initialValue = '{}'; | ||
const nullVersionId = 'emptyCase12345'; | ||
const expectedValue = '{"nullVersionId":"emptyCase12345"}'; | ||
const result = Version.updateOrAppendNullVersionId(initialValue, nullVersionId); | ||
expect(result).toEqual(expectedValue); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.