<commit_before>import chai = require('chai');
import {SpeechletResponseEnvelope} from '../main/response/SpeechletResponseEnvelope';
import {LinkAccountCard} from '../main/response/speech/LinkAccountCard';
import {OutputSpeech} from '../main/response/speech/OutputSpeech';

let expect = chai.expect;

describe('SpeechletResponseEnvelope', () => {
    it('generates a LinkAccount response', (done: any) => {
        let linkAccountResponse = SpeechletResponseEnvelope.linkAccountInstance;

        expect(linkAccountResponse.response.card).to.be.instanceof(LinkAccountCard);
        expect(linkAccountResponse.response.outputSpeech.type).to.eq(OutputSpeech.PLAINTEXT);
        expect(linkAccountResponse.response.outputSpeech.text).to.eq('Please go to your Alexa app and link your account.');
        expect(linkAccountResponse.version).to.eq('1.0');
        expect(linkAccountResponse.response.reprompt);

        console.log(`\n\n${JSON.stringify(linkAccountResponse)}\n\n`);

        done();
    });
});<commit_msg>Adding a test around the sessionAttributes<commit_after>import chai = require('chai');
import {SpeechletResponseEnvelope} from '../main/response/SpeechletResponseEnvelope';
import {LinkAccountCard} from '../main/response/speech/LinkAccountCard';
import {OutputSpeech} from '../main/response/speech/OutputSpeech';
import {Card} from '../main/response/speech/Card';
import {SpeechletResponse} from '../main/response/SpeechletResponse';

let expect = chai.expect;

describe('SpeechletResponseEnvelope', () => {
    it('generates a LinkAccount response', (done: any) => {
        let linkAccountResponse = SpeechletResponseEnvelope.linkAccountInstance;

        expect(linkAccountResponse.response.card).to.be.instanceof(LinkAccountCard);
        expect(linkAccountResponse.response.outputSpeech.type).to.eq(OutputSpeech.PLAINTEXT);
        expect(linkAccountResponse.response.outputSpeech.text).to.eq('Please go to your Alexa app and link your account.');
        expect(linkAccountResponse.version).to.eq('1.0');
        expect(linkAccountResponse.response.reprompt);

        console.log(`\n\n${JSON.stringify(linkAccountResponse)}\n\n`);

        done();
    });

    it('maintains the sessionAttribute property', () => {
        let card = Card.defaultInstance;
        let outputSpeech = new OutputSpeech('TEST', OutputSpeech.PLAINTEXT);
        let response = new SpeechletResponse(outputSpeech, card, null, true);
        let theDate = new Date();
        let sessionAttributes = { key: 'value', date: theDate };
        let envelope = new SpeechletResponseEnvelope(response, sessionAttributes);

        expect(envelope.sessionAttributes).to.not.eq(null);
        expect(envelope.sessionAttributes.key).eq('value');
        expect(envelope.sessionAttributes.date).to.eq(theDate);
    });
});
{'fraction_non_alphanumeric': 0.13477951635846372, 'fraction_numerical': 0.001422475106685633, 'mean_word_length': 4.358095238095238, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2755211', 'n_tokens_mistral': 798, 'n_tokens_neox': 775, 'n_words': 138}