mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-01 15:21:04 +00:00
fix: correct transport config check
This commit is contained in:
parent
da52af704e
commit
e52ce66ab7
@ -29,7 +29,11 @@ const optionsSchema = s(
|
|||||||
peerDiscovery: optional(list([s('object|function')])),
|
peerDiscovery: optional(list([s('object|function')])),
|
||||||
peerRouting: optional(list(['object'])),
|
peerRouting: optional(list(['object'])),
|
||||||
streamMuxer: optional(list([s('object|function')])),
|
streamMuxer: optional(list([s('object|function')])),
|
||||||
transport: list([transport])
|
transport: s.intersection([[transport], s.interface({
|
||||||
|
length (v) {
|
||||||
|
return v > 0 ? true : 'ERROR_EMPTY'
|
||||||
|
}
|
||||||
|
})])
|
||||||
}),
|
}),
|
||||||
config: s({
|
config: s({
|
||||||
peerDiscovery: 'object?',
|
peerDiscovery: 'object?',
|
||||||
@ -52,7 +56,7 @@ const optionsSchema = s(
|
|||||||
}, { enabled: false, queriesPerPeriod: 1, interval: 30000, timeout: 10000 })),
|
}, { enabled: false, queriesPerPeriod: 1, interval: 30000, timeout: 10000 })),
|
||||||
validators: 'object?',
|
validators: 'object?',
|
||||||
selectors: 'object?'
|
selectors: 'object?'
|
||||||
}, { enabled: true, kBucketSize: 20, enabledDiscovery: true }),
|
}, { enabled: false, kBucketSize: 20, enabledDiscovery: false }),
|
||||||
EXPERIMENTAL: s({
|
EXPERIMENTAL: s({
|
||||||
pubsub: 'boolean'
|
pubsub: 'boolean'
|
||||||
}, { pubsub: false })
|
}, { pubsub: false })
|
||||||
|
@ -55,7 +55,7 @@ describe('configuration', () => {
|
|||||||
transport: [ ]
|
transport: [ ]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}).to.throw()
|
}).to.throw('ERROR_EMPTY')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should add defaults to missing items', () => {
|
it('should add defaults to missing items', () => {
|
||||||
@ -95,7 +95,7 @@ describe('configuration', () => {
|
|||||||
},
|
},
|
||||||
dht: {
|
dht: {
|
||||||
kBucketSize: 20,
|
kBucketSize: 20,
|
||||||
enabled: true,
|
enabled: false,
|
||||||
randomWalk: {
|
randomWalk: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
queriesPerPeriod: 1,
|
queriesPerPeriod: 1,
|
||||||
@ -152,8 +152,8 @@ describe('configuration', () => {
|
|||||||
transport: [ WS ]
|
transport: [ WS ]
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
EXPERIMENTAL: {
|
dht: {
|
||||||
dht: true
|
enabled: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ describe('configuration', () => {
|
|||||||
},
|
},
|
||||||
dht: {
|
dht: {
|
||||||
kBucketSize: 20,
|
kBucketSize: 20,
|
||||||
enabled: true,
|
enabled: false,
|
||||||
randomWalk: {
|
randomWalk: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
queriesPerPeriod: 1,
|
queriesPerPeriod: 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user