Skip to main content
Version: 2.1

App Channel Tests 1.2 2.0

Basic Broadcast

AppStepDetails
A1.Retrieve ChannelRetrieve a Channel object representing an 'App' channel called test-channel using:
const testChannel = await fdc3.getOrCreateChannel("test-channel")
A2.Add Context ListenerAdd an untyped context listener to the channel, using:
2.0 await testChannel.addContextListener(null, handler)
1.2 testChannel.addContextListener(null, handler)
B3.Retrieve ChannelRetrieve a Channel object representing the same 'App' channel A did (test-channel)
B4.BroadcastBroadcast an fdc3.instrument Context to the channel with:
testChannel.broadcast(<fdc3.instrument context>)
A5.Receive ContextThe handler added in step 2 will receive the instrument context. Ensure that the instrument received by A is identical to that sent by B.
  • ACBasicUsage1 Perform above test.

Current Context

AppStepDetails
B1.Retrieve ChannelRetrieve a Channel object representing an 'App' channel called test-channel using:
const testChannel = await fdc3.getOrCreateChannel("test-channel")
B2.BroadcastBroadcast an fdc3.instrument to the channel using:
testChannel.broadcast(<fdc3.instrument context>)
A3.Retrieve ChannelRetrieve a Channel object representing the same 'App' channel B did (test-channel)
A4.Retrieve Current ContextA gets the current context of the user channel. via: await testChannel.getCurrentContext()
Ensure that the instrument received by A is identical to that sent by B
  • ACBasicUsage2 Perform above test

Filtered Context

AppStepDetails
A1.Retrieve ChannelRetrieve a Channel object representing an 'App' channel called test-channel using:
const testChannel = await fdc3.getOrCreateChannel("test-channel")
A2.Add Context ListenerAdd an typed context listener for fdc3.instrument, using:
2.0 await testChannel.addContextListener("fdc3.instrument", handler)
1.2 testChannel.addContextListener("fdc3.instrument", handler)
B3.Retrieve ChannelRetrieve a Channel object representing the same 'App' channel A did (test-channel)
B4.BroadcastB broadcasts both an fdc3.instrument context and an fdc3.contact context, using:
testChannel.broadcast(<fdc3.instrument context>)
testChannel.broadcast(<fdc3.contact context>)
A5.Receive ContextAn fdc3.instrument context is received by the handler added in step 2.
Ensure that the fdc3.instrument received by A is identical to that sent by B
Ensure that the fdc3.contact context is NOT received.
  • ACFilteredContext1: Perform above test
  • ACFilteredContext2: Perform above test, but add listeners for both fdc3.instrument and fdc3.contact in step2. Ensure that both context objects are received.
  • ACFilteredContext3: Perform above test, except creating a different channel in app B. Check that you don't receive anything (as the channels don't match).
  • ACFilteredContext4: Perform above test, except that after creating the channel A creates another channel with a further different channel id and adds a further context listener to it. Ensure that A is still able to receive context on the first channel (i.e. it is unaffected by the additional channel) and does NOT receive anything on the second channel.
  • ACUnsubscribe: Perform above test, except that after creating the channel A then unsubscribe()s the listener it added to the channel. Check that A does NOT receive anything.

App Channel History

AppStepDetails
A1.Retrieve ChannelRetrieve a Channel object representing an 'App' channel called test-channel using:
const testChannel = await fdc3.getOrCreateChannel("test-channel")
B2.Retrieve ChannelRetrieve a Channel object representing the same 'App' channel A did (test-channel)
B3.BroadcastB broadcasts both the instrument context and a contact context, using:
testChannel.broadcast(<fdc3.instrument context>)
testChannel.broadcast(<fdc3.contact context>)
A4.Add Context ListenerA adds a context listener to the channel after B has completed all its broadcasts, via:
2.0 await testChannel.addContextListener("fdc3.instrument", handler)
1.2 testChannel.addContextListener("fdc3.instrument", handler)
Ensure that A does NOT receive any context via these listeners (past context is only retrieved via a getCurrentContext() call on App channels).
A5.Retrieve Current ContextA is able to retrieve the most recent context of each context type from the Channel via:
const instrument = await testChannel.getCurrentContext('fdc3.instrument')
const instrument = await testChannel.getCurrentContext('fdc3.contact')
Ensure that both contexts retreived by A are identical to those sent by B
  • ACContextHistoryTyped: Perform above test.
  • ACContextHistoryMultiple: B Broadcasts multiple history items of both types. Ensure that only the last version of each type is received by A.
  • ACContextHistoryLast: In step 5. A retrieves the untyped current context of the channel via const currentContext = await testChannel.getCurrentContext(). Ensure that A receives only the very last broadcast context item of any type.