Skip to content

Commit

Permalink
test: make stat test independent of other tests (#207)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vmx authored and jacobheun committed Sep 9, 2019
1 parent 9ef86f2 commit 9b85b16
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/stat-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9b85b16

Please sign in to comment.