Compare commits

...

1 Commits

Author SHA1 Message Date
Daniel Castaño 88e2301c63
feature: ObjectMD remove object lock ARSN-348 2023-06-22 12:35:05 -05:00
2 changed files with 45 additions and 0 deletions

View File

@ -1458,4 +1458,17 @@ export default class ObjectMD {
getIsPHD() { getIsPHD() {
return this._data.isPHD; return this._data.isPHD;
} }
/**
* Remove Object Lock
* @return {Boolean}
*/
removeObjectLock() {
this.setLegalHold(false);
this.setRetentionDate("");
this.setRetentionMode("");
return this;
}
} }

View File

@ -818,3 +818,35 @@ describe('ObjectMD::getEncodedVersionId', () => {
assert.strictEqual(objMd.getEncodedVersionId(), ExternalNullVersionId); assert.strictEqual(objMd.getEncodedVersionId(), ExternalNullVersionId);
}); });
}); });
describe('ObjectMD::removeObjectLock', () => {
let objMd = null;
beforeEach(() => {
objMd = new ObjectMD();
});
it('should set retention date, retention mode and legal hold like null and fall', () => {
objMd.setLegalHold(true);
objMd.setRetentionDate("DateMock");
objMd.setRetentionMode("ModeMock");
objMd.removeObjectLock();
assert.strictEqual(objMd.getLegalHold(), false);
assert.strictEqual(objMd.getRetentionDate(), "");
assert.strictEqual(objMd.getRetentionMode(), "");
});
it('should call the methods setLegalHold setRetentionDate and setRetentionMode', () => {
objMd.setLegalHold = jest.fn();
objMd.setRetentionDate = jest.fn();
objMd.setRetentionMode = jest.fn();
objMd.removeObjectLock();
expect(objMd.setLegalHold).toBeCalled()
expect(objMd.setRetentionDate).toBeCalled()
expect(objMd.setRetentionMode).toBeCalled()
});
});