Skip to content

Commit

Permalink
Handled listener disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed Mar 12, 2024
1 parent 0578394 commit 43e0b19
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/da-server/test/features/intents.feature
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ Feature: Responding to Directory Requests about Intents
And messaging will have outgoing posts
| msg.payload.appIntent.apps[0].appId | msg.payload.appIntent.apps[0].instanceId |
| libraryApp | {empty} |

Scenario: Disconnecting The Intent Listener
When "App1/b1" unsubscribes an intent listener for "returnBook" with contextType "fdc3.book" and result type "channel<messages>"
When "App1/a1" finds intents with intent "returnBook" and contextType "fdc3.book" and result type "{empty}"
Then messaging will have outgoing posts
| msg.type | msg.payload.appIntent.intent.name | msg.payload.appIntent.apps.length | to.instanceId | msg.payload.appIntent.apps[0].appId |
| findIntentResponse | returnBook | 1 | a1 | libraryApp |
15 changes: 15 additions & 0 deletions packages/da-server/test/step-definitions/intents.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,19 @@ Given('{string} registers an intent listener for {string} with contextType {stri
}
}
this.server.receive(message, meta.source)
});


Given('{string} unsubscribes an intent listener for {string} with contextType {string} and result type {string}', function (this: CustomWorld, appStr: string, intentName: string, contextType: string, resultType: string) {
const meta = createMeta(this, appStr)
const message = {
type: 'onUnsubscribe',
meta,
payload: {
intentName: handleResolve(intentName, this),
contextType: handleResolve(contextType, this),
resultType: handleResolve(resultType, this),
}
}
this.server.receive(message, meta.source)
});

0 comments on commit 43e0b19

Please sign in to comment.