-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
I'd like to propose some tests that we can add to this project so that updates can be made with higher confidence that they don't change the existing behaviour.
My wish-list would be to have high coverage of the public APIs exported by this package. I'll create a PR that updates the npm test script to run mocha against some Connection and Session tests as a base to build on. (I chose mocha to match what rhea is using.)
Here's a list of tests I think should be added based on the API that's exposed today. This list doesn't cover 100% of the API (some error validation would be nice) but should at least cover the happy path.
Connection
- Connection.open
Ensure the connection is in an 'opened' state after Connection.open() yields. - Connection.close
Ensure the connection is no longer in an 'opened' state after Connection.close() yields. - Connection.isOpen()
EnsureisOpen()istrueafterConnection.open()yields. - Connection.isOpen()
EnsureisOpen()isfalseafterConnection.close()yields. - Connection.isRemoteOpen()
EnsureisRemoteOpen()istrueafterConnection.open()yields. - Connection.isRemoteOpen()
EnsureisRemoteOpen()isfalseafterConnection.close()yields. - Connection.on('connectionOpen')
Ensure the connection fires theconnectionOpenevent whenConnection.open()is called. - Connection.on('connectionClose')
Ensure the connection fires theconnectionCloseevent whenConnection.close()is called. - Connection.on('connectionError')
Ensure the connection fires theconnectionErrorevent when service closes the connection with an error. - Connection.createSession()
Ensure the session is created and in anopenstate. - Connection.createSender()
CallcreateSender()without a session and ensure the sender is created and in anopenstate. - Connection.createSender()
CallcreateSender()with a session and ensure the sender is created and in anopenstate. - Connection.createAwaitableSender()
Ensure the sender is created and in anopenstate. - Connection.createReceiver()
Ensure the receiver is created and in anopenstate. - Connection.createRequestResponseLink()
Ensure the RequestResponseLink is created and in anopenstate. - Connection.removeSession()
Create a session viaConnection.createSession(), remove session viaConnection.removeSession()and ensuresession.remove()is called.
Session
- Session.begin()
Ensure the session fires thesessionOpenevent. - Session.close()
Ensure the session is fully closed afterSession.close()yields. - Session.isOpen()
EnsureisOpen()istrueafterconnection.createSessionresolves. - Session.isOpen()
EnsureisOpen()istrueafter thesessionOpenevent is fired. - Session.isClosed()
EnsureisClosed()istrueafterSession.close()yields. - Session.isItselfClosed()
EnsureisItselfClosed()istrueafterSession.close()yields. - Session.remove()
Ensure the session does not have any event listeners registered. - Session.on('sessionOpen')
Ensure the session fires thesessionOpenevent aftersession.begin()is called. - Session.on('sessionClose')
Ensure the session fires thesessionCloseevent aftersession.close()is called. - Session.connection
Ensuresession.connectionmatches theConnectionused to instantiate theSession. - Session.createSender()
Ensure the sender is created and in anopenstate. - Session.createAwaitableSender()
Ensure the sender is created and in anopenstate. - Session.createReceiver()
Ensure the receiver is created and in anopenstate.
RequestResponseLink
- Connection.createRequestResponseLink()
Call method withoutprovidedSessionand ensure the return value includes the following fields,each in theopenstate:sessionsenderreceiver
- Connection.createRequestResponseLink()
Call method withprovidedSessionand ensure thesessionin the return value matches thesessionprovided.
Sender
- Sender.isOpen()
EnsureisOpen()returnstrueafterconnection.createSender()resolves. - Sender.isRemoteOpen()
EnsureisRemoteOpen()returnstrueafterconnection.createSender()resolves. - Sender.isClosed()
EnsureisClosedreturnstrueaftersender.close()resolves. - Sender.isItselfClosed()
EnsureisItselfClosedreturnstrueaftersender.close()resolves. - Sender.isSender()
EnsureisSender()returns true. - Sender.isReceiver()
EnsureisReceiver()returns false. - Sender.remove()
Ensure thesenderand thesessiondo not have any event listeners registered. - Sender.close()
Don't setcloseSession, and ensuresenderandsessionare closed. - Sender.close()
SetcloseSessiontotrue, and ensuresenderandsessionare closed. - Sender.close()
SetcloseSessiontofalse, and ensuresenderis closed andsessionis open. - Sender.name
Returns the sender's name. - Sender.session
Ensure thesender.sessionmatches theSessionused to instantiate theSender. - Sender.connection
Ensure thesender.connectionmatches theConnectionused to instantiate theSender. - Sender.setDrained()
Ensureset_drained()is called on the rhea link. - Sender.sendable()
Ensuresendable()is called on the rhea link. - Sender.send()
Ensuresend()is called on the rhea link with message, tag and format.
AwaitableSender
- Sender.send()
Ensuresendis called on the rhea link with message, tag and format.
Receiver
- Receiver.isOpen()
EnsureisOpen()returnstrueafterconnection.createReceiver()resolves. - Receiver.isRemoteOpen()
EnsureisRemoteOpen()returnstrueafterconnection.createReceiver()resolves. - Receiver.isClosed()
EnsureisClosedreturnstrueafterreceiver.close()resolves. - Receiver.isItselfClosed()
EnsureisItselfClosedreturnstrueafterreceiver.close()resolves. - Receiver.isSender()
EnsureisSender()returnsfalse. - Receiver.isReceiver()
EnsureisReceiver()returnstrue. - Receiver.remove()
Ensure thereceiverand thesessiondo not have any event listeners registered. - Receiver.close()
Don't setcloseSession, and ensurereceiverandsessionare closed. - Receiver.close()
SetcloseSessiontotrue, and ensurereceiverandsessionare closed. - Receiver.close()
SetcloseSessiontofalse, and ensurereceiveris closed andsessionis open. - Receiver.name
Returns the receiver's name. - Receiver.session
Ensure thereceiver.sessionmatches theSessionused to instantiate theReceiver. - Receiver.connection
Ensure thereceiver.connectionmatches theConnectionused to instantiate theReceiver.
Metadata
Metadata
Assignees
Labels
No labels