Skip to content

Latest commit

 

History

History
57 lines (45 loc) · 7.56 KB

File metadata and controls

57 lines (45 loc) · 7.56 KB

App Channel Tests 1.2 2.0

Basic Broadcast

App Step Details
A 1.Retrieve Channel Retrieve a Channel object representing an 'App' channel called test-channel using:
const testChannel = await fdc3.getOrCreateChannel("test-channel")
A 2.Add Context Listener Add an untyped context listener to the channel, using:
2.0 await testChannel.addContextListener(null, handler)
1.2 testChannel.addContextListener(null, handler)
B 3.Retrieve Channel Retrieve a Channel object representing the same 'App' channel A did (test-channel)
B 4.Broadcast Broadcast an fdc3.instrument Context to the channel with:
testChannel.broadcast(<fdc3.instrument context>)
A 5.Receive Context The 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

App Step Details
B 1.Retrieve Channel Retrieve a Channel object representing an 'App' channel called test-channel using:
const testChannel = await fdc3.getOrCreateChannel("test-channel")
B 2.Broadcast Broadcast an fdc3.instrument to the channel using:
testChannel.broadcast(<fdc3.instrument context>)
A 3.Retrieve Channel Retrieve a Channel object representing the same 'App' channel B did (test-channel)
A 4.Retrieve Current Context A 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

App Step Details
A 1.Retrieve Channel Retrieve a Channel object representing an 'App' channel called test-channel using:
const testChannel = await fdc3.getOrCreateChannel("test-channel")
A 2.Add Context Listener Add an typed context listener for fdc3.instrument, using:
2.0 await testChannel.addContextListener("fdc3.instrument", handler)
1.2 testChannel.addContextListener("fdc3.instrument", handler)
B 3.Retrieve Channel Retrieve a Channel object representing the same 'App' channel A did (test-channel)
B 4.Broadcast B broadcasts both an fdc3.instrument context and an fdc3.contact context, using:
testChannel.broadcast(<fdc3.instrument context>)
testChannel.broadcast(<fdc3.contact context>)
A 5.Receive Context An 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

App Step Details
A 1.Retrieve Channel Retrieve a Channel object representing an 'App' channel called test-channel using:
const testChannel = await fdc3.getOrCreateChannel("test-channel")
B 2.Retrieve Channel Retrieve a Channel object representing the same 'App' channel A did (test-channel)
B 3.Broadcast B broadcasts both the instrument context and a contact context, using:
testChannel.broadcast(<fdc3.instrument context>)
testChannel.broadcast(<fdc3.contact context>)
A 4.Add Context Listener A 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).
A 5.Retrieve Current Context A 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.
  • ACClearHistorySpecificContext: Perform the above test, except after step 3 clear context with await testChannel.clearContext('fdc3.instrument'). Ensure that in step 5 nothing is received for const instrument = await testChannel.getCurrentContext('fdc3.instrument') and context is received successfully for const instrument = await testChannel.getCurrentContext('fdc3.contact')
  • ACClearHistoryAllContexts: Perform the above test, except after step 3 clear context with await testChannel.clearContext('fdc3.nothing'). Ensure that in step 5 nothing is received for const instrument = await testChannel.getCurrentContext('fdc3.instrument') and for const instrument = await testChannel.getCurrentContext('fdc3.contact')
  • ACClearHistoryAllContextsSubscribedToNothing: Perform the above test, except after step 3 clear context with await testChannel.clearContext('fdc3.nothing') and in step 4 call await testChannel.addContextListener("fdc3.nothing", handler) instead. Ensure that after clearing context, the handler is called.