import { parameters , defaultTiming , updateTiming } from '../index' ; import { ParametersUpdate } from '../models/models' ; import { expect } from 'chai' ; describe ( 'Parameters' , function ( ) { afterEach ( function ( ) { defaultTiming ( ) ; } ) ; it ( 'should ignore empty parameter' , function ( ) { updateTiming ( ) ; expect ( parameters . maxRTT ) . to . eql ( 202 ) ; expect ( parameters . exchangeLifetime ) . to . eql ( 247 ) ; expect ( parameters . maxTransmitSpan ) . to . eql ( 45 ) ; expect ( parameters . maxTransmitWait ) . to . eql ( 93 ) ; } ) ; it ( 'should verify custom timings' , function ( ) { const coapTiming = { ackTimeout : 1 , ackRandomFactor : 2 , maxRetransmit : 3 , maxLatency : 5 , piggybackReplyMs : 6 } ; updateTiming ( coapTiming ) ; expect ( parameters . maxRTT ) . to . eql ( 11 ) ; expect ( parameters . exchangeLifetime ) . to . eql ( 25 ) ; expect ( parameters . maxTransmitSpan ) . to . eql ( 14 ) ; expect ( parameters . maxTransmitWait ) . to . eql ( 30 ) ; } ) ; it ( 'should verify default timings' , function ( ) { expect ( parameters . maxRTT ) . to . eql ( 202 ) ; expect ( parameters . exchangeLifetime ) . to . eql ( 247 ) ; expect ( parameters . maxTransmitSpan ) . to . eql ( 45 ) ; expect ( parameters . maxTransmitWait ) . to . eql ( 93 ) ; } ) ; } ) ;