bespoken / virtual-alexa

:robot: Easily test and debug Alexa skills programmatically
https://bespoken.io
Apache License 2.0
112 stars 35 forks source link

How to simulate a linked account? #101

Closed westlakem closed 5 years ago

westlakem commented 5 years ago

Is your feature request related to a problem? Please describe. We are trying to unit test a feature that requires account linking.

Describe the solution you'd like A way to simulate an account linked device that is able to hit Amazon's profile APIs (we need to hit their APIs once "account linked"

jkelvie commented 5 years ago

If you set the access token on the context, it will emulate a user who has linked their account: virtualAlexa.context().setAccessToken(testSuite.accessToken);

We do not have builtin mocks for the profile API, but you we have them for the Address API - a similar approach using Nock (a great mocking tool) will work for the Profile API: https://github.com/bespoken/virtual-alexa/blob/master/src/external/AddressAPI.ts#L67

westlakem commented 5 years ago

Ok, I was looking for mocks of the profile api.