Hi
in test unit, when i want test an intent, i must store this.$session.$data.key in my intent
and retrieve in unit test.
async ON_REQUEST() {
const todayFormat = getCurrentDateFormat();
const response = await fetchUrlData(todayFormat);
this.$data.eventoo = response.data;
},
async LAUNCH() {
this.$session.$data.sapEvent = this.$data.eventoo
let speech = "bienvenue sur SAP, voulez sortir ? " + this.$data.eventoo.data[0].title;
let reprompt = 'nom d une sortie ou une categorie.';
this.ask(speech, reprompt);
},
YesIntent() {
let speech = this.$data.eventoo.data[0].abstract; // work
// let speech = this.$session.$data; // not work (undefined)
this.tell(speech);
},
file.test.js contain
it('fetch 1st event title', async () => {
const on_request = await testSuite.requestBuilder.launch();
const response = await conversation.send(on_request);
const receive = response.getSessionData().sapEvent.data[0].title
const expected = "Réouverture du Musée de la Libération de Paris";
expect(receive).toEqual(expected);
but i can’t use this same key between intent, so I must store this.$data.key and can share the same key
So I just create $session for unit test … and can’t use this.$data.eventoo already exist
it overkill for me