Closed AngavaiS closed 6 years ago
Hi @AngavaiS - with regard to Dynamo, we do not mock all Dynamo functions, just get and put. If you want to mock the query operation, you can use our code as a template for adding your own nock mock: https://github.com/bespoken/virtual-alexa/blob/master/src/external/DynamoDB.ts#L104
With regard to your question about the Address API - can you share with us the code you are using to call it?
I'm closing this issue for the time being since there has been no response. @AngavaiS if you have more details, please re-open and add here. Thanks.
Hello,
I've been using 'virtual-alexa' for my end-to-end testing needs and it's pretty neat!
However, I am stuck on mocking dynamodb calls and the address api calls.
I tried using 'virtualAlexa.dynamoDB().mock();' but that does not seem to help me when I'm querying using: AWS.DynamoDB.DocumentClient().
This is how it's being used:
this.docClient = new AWS.DynamoDB.DocumentClient();
getUser(alexaUserId) { const params = { //TableName: process.env.user_table_name, TableName: 'UserAttributes', KeyConditionExpression: '#alexaUserId = :alexaUserId', ExpressionAttributeNames: { '#alexaUserId': 'alexaUserId', }, ExpressionAttributeValues: { ':alexaUserId': alexaUserId, }, };
}
In the readme: https://github.com/bespoken/virtual-alexa/blob/master/docs/Externals.md#dynamodb
it says that I can make normal calls to DynamoDB but it does not seem to be working. I'm running into something like below:
Earlier, I was running into this error: MissingRequiredParameter: Missing required key 'TableName' in params and I fixed it by changing: TableName: process.env.user_table_name, to: TableName: 'UserAttributes',
The key error seems to deal with the KeyConditionExpression formatting. I'd like some more help on this
Also, regarding address api, I tried using the example here: https://github.com/bespoken/virtual-alexa/blob/master/docs/Externals.md#address-api
However, after filling out the mocked address info, I am running into this error: FetchError: request to https://api.amazonalexa.com/v1/devices/virtualAlexa.deviceID.b9d8670b-ec22-4525-bb7c-d1f091bcba30/settings/address failed, reason: Nock: No match for request { "method": "GET", "url": "https://api.amazonalexa.com/v1/devices/virtualAlexa.deviceID.b9d8670b-ec22-4525-bb7c-d1f091bcba30/settings/address", "headers": { "authorization": [ "Bearer virtualAlexa.accessToken.201f95ed-1da2-4597-84ef-c165a09ed0c9" ], "accept-encoding": [ "gzip,deflate" ], "user-agent": [ "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" ], "connection": [ "close" ], "accept": [ "/" ] } }
I'm stumped on why this is happening. Help would be much appreciated.
Thank you, John Chung jonnnc@gmail.com (714) 337-0112