in testData.js [16:34]
constructor(obj, query) {
this.name = (query && query.name) || (obj && obj.name) || (query?.url?.split('/').pop()) || (query?.path?.split('/').pop());
this.version = (query && query.version) || (obj && obj.version);
this.timeout = (query && query.timeout) || (obj && obj.timeout) || config.defaults.timeoutMilliseconds;
this.bot = (query && query.bot) || (obj && obj.bot) || process.env["DefaultBot"];
if (!this.bot) {
throw new Error("Configuration error: No bot name was given as a query parameter nor as a test property and no DefaultBot in application settings.");
}
this.secret = query?.botSecret || obj?.botSecret || this.getSecretFromEnvVar();
this.customDirectlineDomain = query?.customDirectlineDomain || obj?.customDirectlineDomain;
if (!this.secret) {
throw new Error(`Configuration error: BotSecret is missing for ${this.bot}.`);
}
this.userId = (query && (query.userId || query.userid)) || (obj && (obj.userId || obj.userid));
this.messages = (obj && obj.messages) || Transcript.getMessages(obj);
if (!(this.messages && Array.isArray(this.messages) && this.messages.length > 0)) {
throw new Error("A test must contain a non-empty 'messages' array or consist of a bot conversation transcript.")
}
}