Skip to content

Commit

Permalink
ARSN-178: add tests for AmzRestore header
Browse files Browse the repository at this point in the history
  • Loading branch information
williamlardier committed May 3, 2022
1 parent c00d654 commit 0afddfa
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/unit/models/ObjectMD.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ describe('ObjectMD class setters/getters', () => {
['AmzServerVersionId', 'server-version-id'],
['AmzStorageClass', null, 'STANDARD'],
['AmzStorageClass', 'storage-class'],
['AmzRestore', null, {
'ongoing-request': false,
}],
['AmzRestore', {
'ongoing-request': false,
}],
['AmzServerSideEncryption', null, ''],
['AmzServerSideEncryption', 'server-side-encryption'],
['AmzEncryptionKeyId', null, ''],
Expand Down Expand Up @@ -417,6 +423,7 @@ describe('getAttributes static method', () => {
'x-amz-server-side-encryption-aws-kms-key-id': true,
'x-amz-server-side-encryption-customer-algorithm': true,
'x-amz-website-redirect-location': true,
'x-amz-restore': true,
'acl': true,
'key': true,
'location': true,
Expand Down
26 changes: 26 additions & 0 deletions tests/unit/models/ObjectMDAmzRestore.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const assert = require('assert');
const ObjectMDAmzRestore = require('../../../lib/models/ObjectMDAmzRestore');

const amzRestore = new ObjectMDAmzRestore(false, new Date());

describe('ObjectMDAmzRestore value', () => {
it('should return the correct value', () => {
const amzRestoreObj = amzRestore.getValue();
assert.deepStrictEqual(amzRestoreObj, amzRestore);
});
});

describe('ObjectMDAmzRestore setters/getters', () => {
it('should control the ongoing-request attribute', () => {
const ongoing = true;
amzRestore.setOngoingRequest(ongoing);
assert.deepStrictEqual(amzRestore.getOngoingRequest(),
ongoing);
});
it('should control the expiry-date attribute', () => {
const expiry = new Date(100);
amzRestore.setExpiryDate(expiry);
assert.deepStrictEqual(amzRestore.getExpiryDate(),
expiry);
});
});

0 comments on commit 0afddfa

Please sign in to comment.