Skip to content

Commit 9b85b16

Browse files
vmxjacobheun
authored andcommitted
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.
1 parent 9ef86f2 commit 9b85b16

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/stat-test.js

+10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@
44
const chai = require('chai')
55
chai.use(require('dirty-chai'))
66
const expect = chai.expect
7+
const Block = require('ipfs-block')
8+
const CID = require('cids')
79

810
module.exports = (repo) => {
911
describe('stat', () => {
12+
before(async () => {
13+
const data = new Block(
14+
Buffer.from('foo'),
15+
new CID('bafyreighz6vdlkdsvp4nu3lxhsofnk2eqxn6o57ag3mfxkqa7c327djhra')
16+
)
17+
await repo.blocks.put(data)
18+
})
19+
1020
it('get stats', async () => {
1121
const stats = await repo.stat()
1222
expect(stats).to.exist()

0 commit comments

Comments
 (0)