Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST CAPABILITY] Presence capability for feature-based testing examples #2581

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alexneyman-MSFT
Copy link
Contributor

For more information about how to contribute to this repo, visit this page.

Description

Summarize the changes, including the goals and reasons for this change. Be sure to call out any technical or behavior changes that reviewers should be aware of.

If this Pull Request should close/resolve any issues when merged, use the special syntax for that here.

Main changes in the PR:

  1. <Change 1>
  2. <Change 2>

Validation

Validation performed:

  1. <Step 1>
  2. <Step 2>

Unit Tests added:

Unit tests are required for all changes. If no unit tests were added as part of this change, please explain why they aren't necessary.

<Yes/No>

End-to-end tests added:

<Yes/No>

Additional Requirements

Change file added:

Ensure the change file meets the formatting requirements.

<Yes/No>

Related PRs:

Remove this section if n/a

Next/remaining steps:

List the next or remaining steps in implementing the overall feature in subsequent PRs (or is the feature 100% complete after this?).

Remove this section if n/a

  • Item 1
  • Item 2

Screenshots:

Remove this section if n/a

Before After
< image1 > < image2 >

Copy link
Contributor

This pull request contains changes to the runtime.ts file. If you, as the author of this PR, have made changes to the Runtime interface please review RUNTIME.md to determine if a new runtime version is required. Please reply to this comment stating what changes, if any, were made to the runtime object and whether a new runtime version was required.

@alexneyman-MSFT alexneyman-MSFT changed the title [FAKE CAPABILITY] Presence capability for feature-based testing examples [TEST CAPABILITY] Presence capability for feature-based testing examples Oct 28, 2024
return callFunctionInHostAndHandleResponse(
'presence.setPresence',
[new SerializableSetPresenceParams(params)],
new VoidResponseHandler(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You actually can use the simpler version of this since you don't expect to get anything back except an SdkError in the case that the host has an error it wants to return to the user. Check out callFunctionInHost. You can see some examples of it being used in externalAppAuthenticationForCEA.ts

/**
* Response handler for presence information
*/
class UserPresenceResponseHandler extends ResponseHandler<UserPresence, UserPresence> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct (based on how everything works today). Because you are passing back an interface with multiple parameters you need to spend time thinking about

  1. What validation you want to do to ensure that you are receiving correctly formatted data from the host
  2. What (if anything) you need to do to convert what you get from the host into what you want to pass to the developer

/**
* Response handler for void responses
*/
class VoidResponseHandler extends ResponseHandler<void, void> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably won't need this anymore once you start using callFunctionInHost which I talk about below

/**
* Serializable wrapper for GetPresenceParams
*/
class SerializableGetPresenceParams implements ISerializable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed and correct because you are passing a complex interface (as opposed to a primitive or array of primitives). If you instead decided to pass the contents of GetPresenceParams as an array of primitives you wouldn't need to make a class like this. Both approaches are/can be correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants