Skip to content

Commit

Permalink
fix: interoperability with go repo - added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Jul 23, 2018
1 parent 53ccd4b commit 20f7f99
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

module.exports = {
repoVersion: 6
repoVersion: 7
}
1 change: 0 additions & 1 deletion src/default-datastore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

// Default configuration for the datastore spec in node.js
module.exports = {
StorageMax: '10GB',
StorageGCWatermark: 90,
GCPeriod: '1h',
BloomFilterSize: 0,
Expand Down
24 changes: 22 additions & 2 deletions test/repo-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,31 @@ module.exports = (repo) => {
})
})

describe('spec', () => {
it('get spec', (done) => {
repo.spec.get((err) => {
expect(err).to.not.exist()
done()
})
})

it('set spec', (done) => {
series([
(cb) => repo.spec.set({ a: 'b' }, cb),
(cb) => repo.spec.get((err, spec) => {
if (err) return cb(err)
expect(spec).to.deep.equal({ a: 'b' })
cb()
})
], done)
})
})

describe('version', () => {
it('get version', (done) => {
repo.version.get((err, version) => {
expect(err).to.not.exist()
expect(version).to.equal(6)
expect(version).to.equal(7)
done()
})
})
Expand All @@ -78,7 +98,7 @@ module.exports = (repo) => {
expect(version).to.equal(9000)
cb()
},
(cb) => repo.version.set(6, cb)
(cb) => repo.version.set(7, cb)
], done)
})
})
Expand Down
1 change: 1 addition & 0 deletions test/test-repo/datastore_spec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mounts":[{"mountpoint":"/blocks","path":"blocks","shardFunc":"/repo/flatfs/shard/v1/next-to-last/2","type":"flatfs"},{"mountpoint":"/","path":"datastore","type":"levelds"}],"type":"mount"}
2 changes: 1 addition & 1 deletion test/test-repo/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6
7

0 comments on commit 20f7f99

Please sign in to comment.