UNPKG

@microsoft/teams-ai

Version:

SDK focused on building AI based applications for Microsoft Teams.

44 lines 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TestTurnState = void 0; const TurnState_1 = require("../../TurnState"); const botbuilder_1 = require("botbuilder"); /** * A test version of the TurnState class used by unit tests. */ class TestTurnState extends TurnState_1.TurnState { /** * @private */ constructor() { super(); } /** * Creates a new `TestTurnState` instance. * @param {TurnContext} context Context for the current turn of conversation with the user. * @param {TestTurnState} testState Optional. State to initialize the new instance with. * @param {any} testState.user User state to initialize the new instance with. * @param {any} testState.conversation Conversation state to initialize the new instance with. * @param {any} testState.temp Temporary state to initialize the new instance with. * @returns {Promise<TestTurnState>} Created `TestTurnState` instance. */ static async create(context, testState) { const storage = new botbuilder_1.MemoryStorage(); const state = new TestTurnState(); await state.load(context, storage); if (testState) { if (testState.user) { state.user = testState.user; } if (testState.conversation) { state.conversation = testState.conversation; } if (testState.temp) { state.temp = testState.temp; } } return state; } } exports.TestTurnState = TestTurnState; //# sourceMappingURL=TestTurnState.js.map