Skip to content

Commit 7d5c0f1

Browse files
committed
test: add extra test for default repo creation
1 parent f3d9989 commit 7d5c0f1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/testProxyRoute.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,4 +559,28 @@ describe('proxy express application', async () => {
559559
res2.should.have.status(200);
560560
expect(res2.text).to.contain('Rejecting repo');
561561
}).timeout(5000);
562+
563+
it('should create the default repo if it does not exist', async function () {
564+
// Remove the default repo from the db and check it no longer exists
565+
await cleanupRepo(TEST_DEFAULT_REPO.url);
566+
567+
const repo = await db.getRepoByUrl(TEST_DEFAULT_REPO.url);
568+
expect(repo).to.be.null;
569+
570+
// Restart the proxy
571+
await proxy.stop();
572+
await proxy.start();
573+
574+
// Check that the default repo was created in the db
575+
const repo2 = await db.getRepoByUrl(TEST_DEFAULT_REPO.url);
576+
expect(repo2).to.not.be.null;
577+
578+
// Check that the default repo isn't duplicated on subsequent restarts
579+
await proxy.stop();
580+
await proxy.start();
581+
582+
const repo3 = await db.getRepoByUrl(TEST_DEFAULT_REPO.url);
583+
expect(repo3).to.not.be.null;
584+
expect(repo3._id).to.equal(repo2._id);
585+
});
562586
});

0 commit comments

Comments
 (0)