From ce59763bbe362b721483ed9495f7873afffae660 Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Mon, 10 May 2021 15:12:42 +0100 Subject: [PATCH] Basic tests for exportPackage function #76 --- test/core.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/core.js b/test/core.js index 1a7fd55..1e6187c 100644 --- a/test/core.js +++ b/test/core.js @@ -65,3 +65,17 @@ describe('fetchResponse', async function() { assert.equal(body, false) }) }) + +describe('exportPackages', async function() { + it('adds all packages to an mfs directory', async () => { + await db.clear() + + await core.addUrltoIPFS(db, 'go', 'github.com/mr-tron/base58', 'v1.0.0', `https://proxy.golang.org/github.com/mr-tron/base58/@v/v1.0.0.zip`) + + var stats = await core.exportPackages(db) + + assert.equal(stats.blocks, 1) + assert.equal(stats.cumulativeSize, 13221) + assert.equal(stats.cid.toString(), 'bafybeigryrrcydhinskpju3vrsdnl7r57nakusl54cm6snc4o37djjhdu4') + }) +})