Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 9ff2a32

Browse files
committed
feat: add test for listing config profiles
This is only in js-IPFS for the time being
1 parent ac4d362 commit 9ff2a32

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/config/profile.js

+19-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = (createCommon, options) => {
3636
(cb) => ipfs.config.get(cb),
3737
(_config, cb) => {
3838
config = _config
39-
ipfs.config.profile('lowpower', { dryRun: true }, cb)
39+
ipfs.config.profile.apply('lowpower', { dryRun: true }, cb)
4040
},
4141
(diff, cb) => {
4242
expect(diff.oldCfg.Swarm.ConnMgr.LowWater).to.not.equal(diff.newCfg.Swarm.ConnMgr.LowWater)
@@ -52,8 +52,7 @@ module.exports = (createCommon, options) => {
5252
it('should set a config profile', (done) => {
5353
let diff
5454
waterfall([
55-
(cb) => ipfs.config.get(cb),
56-
(config, cb) => ipfs.config.profile('lowpower', cb),
55+
(cb) => ipfs.config.profile.apply('lowpower', cb),
5756
(_diff, cb) => {
5857
diff = _diff
5958
expect(diff.oldCfg.Swarm.ConnMgr.LowWater).to.not.equal(diff.newCfg.Swarm.ConnMgr.LowWater)
@@ -65,5 +64,22 @@ module.exports = (createCommon, options) => {
6564
}
6665
], done)
6766
})
67+
68+
it('should list config profiles', (done) => {
69+
waterfall([
70+
(cb) => ipfs.config.profile.list(cb),
71+
(profiles, cb) => {
72+
expect(profiles).to.be.an('array')
73+
expect(profiles).not.to.be.empty()
74+
75+
profiles.forEach(profile => {
76+
expect(profile.name).to.be.a('string')
77+
expect(profile.description).to.be.a('string')
78+
})
79+
80+
cb()
81+
}
82+
], done)
83+
})
6884
})
6985
}

0 commit comments

Comments
 (0)