Fix failing backup test

This commit is contained in:
Girish Ramakrishnan
2020-06-12 12:58:11 -07:00
parent e3af61ca4a
commit 65d8074a07
+7 -5
View File
@@ -115,20 +115,22 @@ describe('retention policy', function () {
expect(b[3].keepReason).to.be(undefined);
});
it('2 daily, 6 monthly, 1 yearly', function () {
it('2 daily, 3 monthly, 1 yearly', function () {
let b = [
{ id: '1', creationTime: moment().toDate() },
{ id: '2', creationTime: moment().subtract(3, 'h').toDate() },
{ id: '3', creationTime: moment().subtract(26, 'h').toDate() },
{ id: '4', creationTime: moment().subtract(5, 'd').toDate() },
{ id: '5', creationTime: moment().subtract(10, 'd').toDate() }
{ id: '4', creationTime: moment().subtract(32, 'd').toDate() },
{ id: '5', creationTime: moment().subtract(63, 'd').toDate() },
{ id: '6', creationTime: moment().subtract(65, 'd').toDate() },
];
backups._applyBackupRetentionPolicy(b, { keepDaily: 2, keepMonthly: 6, keepYearly: 1 });
backups._applyBackupRetentionPolicy(b, { keepDaily: 2, keepMonthly: 3, keepYearly: 1 });
expect(b[0].keepReason).to.be('keepDaily'); // today
expect(b[1].keepReason).to.be('keepMonthly');
expect(b[2].keepReason).to.be('keepDaily'); // yesterday
expect(b[3].keepReason).to.be('keepMonthly');
expect(b[4].keepReason).to.be('keepYearly');
expect(b[4].keepReason).to.be('keepMonthly');
expect(b[5].keepReason).to.be('keepYearly');
});
});