fix: allow switch to be configured (#354)

This commit is contained in:
Jacob Heun 2019-04-12 11:10:09 +02:00 committed by GitHub
parent 4cb541ddae
commit eb5aa03232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -85,6 +85,7 @@ const configSchema = s({
})
const optionsSchema = s({
switch: 'object?',
connectionManager: s('object', {
minPeers: 25
}),

View File

@ -170,6 +170,33 @@ describe('configuration', () => {
expect(validateConfig(options)).to.deep.equal(expected)
})
it('should allow for configuring the switch', () => {
const options = {
peerInfo,
switch: {
blacklistTTL: 60e3,
blackListAttempts: 5,
maxParallelDials: 100,
maxColdCalls: 50,
dialTimeout: 30e3
},
modules: {
transport: [ WS ],
peerDiscovery: [ ]
}
}
expect(validateConfig(options)).to.deep.include({
switch: {
blacklistTTL: 60e3,
blackListAttempts: 5,
maxParallelDials: 100,
maxColdCalls: 50,
dialTimeout: 30e3
}
})
})
it('should allow for delegated content and peer routing', () => {
const peerRouter = new DelegatedPeerRouter()
const contentRouter = new DelegatedContentRouter(peerInfo)