import { PeerServer } from '../../../src/peer_server' ; import { P2PNodeInfo } from '../../../src/types' ; import { PeerBook , PeerBookConfig } from '../../../src/peer_book' ; import { validatePeerCompatibility } from '../../../src/utils' ; import { DEFAULT_RANDOM_SECRET , DEFAULT_WS_MAX_PAYLOAD , DEFAULT_MAX_PEER_INFO_SIZE , } from '../../../src/constants' ; describe ( 'peerServer' , ( ) => { const nodeInfo = { networkIdentifier : '73458irc3yb7rg37r7326dbt7236' , networkVersion : '1.1' , nonce : 'nonce' , advertiseAddress : true , options : { } , } ; const peerBookConfig = { sanitizedPeerLists : { blacklistedIPs : [ ] , seedPeers : [ ] , fixedPeers : [ ] , whitelisted : [ ] , previousPeers : [ ] , } , secret : DEFAULT_RANDOM_SECRET , } ; const peerServerConfig = { port : 5000 , nodeInfo , hostIp : '0.0.0.0' , secret : DEFAULT_RANDOM_SECRET , peerBook : new PeerBook ( peerBookConfig ) , maxPayload : DEFAULT_WS_MAX_PAYLOAD , maxPeerInfoSize : DEFAULT_MAX_PEER_INFO_SIZE , peerHandshakeCheck : validatePeerCompatibility , } ; const peerServer = new PeerServer ( peerServerConfig ) ; describe ( '#constructor' , ( ) => { it ( 'should be an object' , ( ) => { return expect ( peerServer ) . toEqual ( expect . any ( Object ) ) ; } ) ; it ( 'should be an instance of P2P' , ( ) => { return expect ( peerServer ) . toBeInstanceOf ( PeerServer ) ; } ) ; } ) ; } ) ;