Fix tests

This commit is contained in:
Girish Ramakrishnan
2023-07-11 16:32:28 +05:30
parent 2d4e7c9c0a
commit 5beb7d7d92
5 changed files with 15 additions and 16 deletions
+7 -7
View File
@@ -39,10 +39,6 @@ describe('backuptask', function () {
await settings.setBackupConfig(backupConfig);
});
after(function () {
fs.rmSync(backupConfig.backupFolder, { recursive: true, force: true });
});
async function createBackup() {
const taskId = await backups.startBackupTask({ username: 'test' });
@@ -76,7 +72,7 @@ describe('backuptask', function () {
const result = await createBackup();
expect(fs.statSync(path.join(backupConfig.backupFolder, 'snapshot/box.tar.gz')).nlink).to.be(2); // hard linked to a rotated backup
expect(fs.statSync(path.join(backupConfig.backupFolder, `${result.id}.tar.gz`)).nlink).to.be(2);
expect(fs.statSync(path.join(backupConfig.backupFolder, `${result.remotePath}.tar.gz`)).nlink).to.be(2);
backupInfo1 = result;
});
@@ -90,8 +86,12 @@ describe('backuptask', function () {
const result = await createBackup();
expect(fs.statSync(path.join(backupConfig.backupFolder, 'snapshot/box.tar.gz')).nlink).to.be(2); // hard linked to a rotated backup
expect(fs.statSync(path.join(backupConfig.backupFolder, `${result.id}.tar.gz`)).nlink).to.be(2); // hard linked to new backup
expect(fs.statSync(path.join(backupConfig.backupFolder, `${backupInfo1.id}.tar.gz`)).nlink).to.be(1); // not hard linked anymore
expect(fs.statSync(path.join(backupConfig.backupFolder, `${result.remotePath}.tar.gz`)).nlink).to.be(2); // hard linked to new backup
expect(fs.statSync(path.join(backupConfig.backupFolder, `${backupInfo1.remotePath}.tar.gz`)).nlink).to.be(1); // not hard linked anymore
});
it('cleanup', function () {
fs.rmSync(backupConfig.backupFolder, { recursive: true, force: true });
});
});
});
+1 -1
View File
@@ -118,7 +118,7 @@ describe('Domains', function () {
const [error] = await safe(domains.del(DOMAIN_0.domain, auditSource));
expect(error.reason).to.equal(BoxError.CONFLICT);
expect(error.message).to.contain('Domain is in use by one or more app');
expect(error.message).to.contain('Domain is in use in an app\'s location');
await apps.del(appCopy.id);
});
+2 -2
View File
@@ -69,7 +69,7 @@ describe('Notifications', function () {
});
it('cannot update non-existent notification', async function () {
const [error] = await safe(notifications.update({ id: 'random' }, { title: 'updated title 0', message: 'updated message 0', acknowledged: true }));
const [error] = await safe(notifications.update({ id: '1245' }, { title: 'updated title 0', message: 'updated message 0', acknowledged: true }));
expect(error.reason).to.be(BoxError.NOT_FOUND);
});
@@ -79,7 +79,7 @@ describe('Notifications', function () {
});
it('cannot delete non-existent notification', async function () {
const [error] = await safe(notifications.del('random'));
const [error] = await safe(notifications.del('5213'));
expect(error.reason).to.be(BoxError.NOT_FOUND);
});
+1 -1
View File
@@ -78,7 +78,7 @@ describe('task', function () {
});
it('del missing task fails', async function () {
const [error] = await safe(tasks._del('random'));
const [error] = await safe(tasks._del('1235'));
expect(error.reason).to.be(BoxError.NOT_FOUND);
});