mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-13 01:01:23 +00:00
fix: pubsub configuration (#404)
* fix: add pubsub default config (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net> * docs: add default pubsub config to README (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net> * fix: pass config to provided PubSub (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net> * docs: adapt pubsub/example for new config (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net> * Update examples/pubsub/README.md Co-Authored-By: Jacob Heun <jacobheun@gmail.com> * test: add pubsub config tests (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net>
This commit is contained in:
@ -83,7 +83,10 @@ describe('configuration', () => {
|
||||
autoDial: true
|
||||
},
|
||||
pubsub: {
|
||||
enabled: true
|
||||
enabled: true,
|
||||
emitSelf: true,
|
||||
signMessages: true,
|
||||
strictSigning: true
|
||||
},
|
||||
dht: {
|
||||
kBucketSize: 20,
|
||||
@ -145,7 +148,10 @@ describe('configuration', () => {
|
||||
}
|
||||
},
|
||||
pubsub: {
|
||||
enabled: true
|
||||
enabled: true,
|
||||
emitSelf: true,
|
||||
signMessages: true,
|
||||
strictSigning: true
|
||||
},
|
||||
dht: {
|
||||
kBucketSize: 20,
|
||||
@ -270,7 +276,10 @@ describe('configuration', () => {
|
||||
},
|
||||
config: {
|
||||
pubsub: {
|
||||
enabled: true
|
||||
enabled: true,
|
||||
emitSelf: true,
|
||||
signMessages: true,
|
||||
strictSigning: true
|
||||
},
|
||||
peerDiscovery: {
|
||||
autoDial: true
|
||||
|
@ -367,4 +367,70 @@ describe('.pubsub', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('.pubsub config', () => {
|
||||
it('toggle all pubsub options off (except enabled)', done => {
|
||||
expect(3).checks(done)
|
||||
|
||||
class PubSubSpy {
|
||||
constructor (node, config) {
|
||||
expect(config).to.be.eql({
|
||||
enabled: true,
|
||||
selfEmit: false,
|
||||
signMessages: false,
|
||||
strictSigning: false
|
||||
}).mark()
|
||||
}
|
||||
}
|
||||
|
||||
createNode('/ip4/0.0.0.0/tcp/0', {
|
||||
modules: {
|
||||
pubsub: PubSubSpy
|
||||
},
|
||||
config: {
|
||||
pubsub: {
|
||||
enabled: true,
|
||||
selfEmit: false,
|
||||
signMessages: false,
|
||||
strictSigning: false
|
||||
}
|
||||
}
|
||||
}, (err, node) => {
|
||||
expect(err).to.not.exist().mark()
|
||||
expect(node).to.exist().mark()
|
||||
})
|
||||
})
|
||||
|
||||
it('toggle all pubsub options on', done => {
|
||||
expect(3).checks(done)
|
||||
|
||||
class PubSubSpy {
|
||||
constructor (node, config) {
|
||||
expect(config).to.be.eql({
|
||||
enabled: true,
|
||||
selfEmit: true,
|
||||
signMessages: true,
|
||||
strictSigning: true
|
||||
}).mark()
|
||||
}
|
||||
}
|
||||
|
||||
createNode('/ip4/0.0.0.0/tcp/0', {
|
||||
modules: {
|
||||
pubsub: PubSubSpy
|
||||
},
|
||||
config: {
|
||||
pubsub: {
|
||||
enabled: true,
|
||||
selfEmit: true,
|
||||
signMessages: true,
|
||||
strictSigning: true
|
||||
}
|
||||
}
|
||||
}, (err, node) => {
|
||||
expect(err).to.not.exist().mark()
|
||||
expect(node).to.exist().mark()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user