Hi @AlexSwe - I have hit some snags trying out this new feature. It seems that session data from the last response in a conversation is being saved to the previous responses. Using the unit testing example, make the following changes:
Update this intent in app.js
CheckPowerUserIntent() {
this.$session.$data.someData = 'TestData';
const sessionsCount = this.$user.$metaData.sessionsCount;
if (sessionsCount > 10) {
this.ask('Hey buddy!');
} else {
this.ask('Hello sir!')
}
},
Then just paste this code over everything in sample_sendToApp.test.js
'use strict';
const { App, Util } = require('jovo-framework');
const { GoogleAssistant } = require('jovo-platform-googleassistant');
const { Alexa } = require('jovo-platform-alexa');
// jest.setTimeout(500);
for (const p of [new GoogleAssistant()]) {
const testSuite = p.makeTestSuite();
describe(`PLATFORM: ${p.constructor.name} INTENTS` , () => {
test('should return a welcome message and ask for the name at "LAUNCH"', async () => {
const conversation = testSuite.conversation({
runtime: "app"
});
const launchRequest = await testSuite.requestBuilder.intent('HelloWorldIntent');
const responseLaunchRequest = await conversation.send(launchRequest);
const launchRequest2 = await testSuite.requestBuilder.intent('CheckPowerUserIntent');
const responseLaunchRequest2 = await conversation.send(launchRequest2);
console.log('------------------------------------');
console.log(responseLaunchRequest.outputContexts);
console.log('------------------------------------');
console.log('------------------------------------');
console.log(responseLaunchRequest2.outputContexts);
console.log('------------------------------------');
expect(
responseLaunchRequest.isAsk('Hello World! What\'s your name?', 'Please tell me your name.')
).toBe(true);
});
});
}
Next, run the test and you should see on the log that the someData
attribute is part of the session data for the first response, when it should not be.
Take out the runtime: "app"
option from the conversation and this does not occur. Also, this appears to be google only, which is why its not in the sample above.
Very odd indeed, thoughts?