From 9b85b163829ea9f6acde722a72f22521396f3429 Mon Sep 17 00:00:00 2001 From: Volker Mische Date: Mon, 9 Sep 2019 16:20:37 +0200 Subject: [PATCH] test: make stat test independent of other tests (#207) Prior to this change running only the stat tests via: npx mocha test/node.js --grep stats would fail, as they expect to have data in the repo. --- test/stat-test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/stat-test.js b/test/stat-test.js index 2db0d8c3..aceb8938 100644 --- a/test/stat-test.js +++ b/test/stat-test.js @@ -4,9 +4,19 @@ const chai = require('chai') chai.use(require('dirty-chai')) const expect = chai.expect +const Block = require('ipfs-block') +const CID = require('cids') module.exports = (repo) => { describe('stat', () => { + before(async () => { + const data = new Block( + Buffer.from('foo'), + new CID('bafyreighz6vdlkdsvp4nu3lxhsofnk2eqxn6o57ag3mfxkqa7c327djhra') + ) + await repo.blocks.put(data) + }) + it('get stats', async () => { const stats = await repo.stat() expect(stats).to.exist()