UNPKG

@makingchatbots/genesys-cloud-chatbot-tester-cli

Version:

[![npm](https://img.shields.io/npm/v/@makingchatbots/genesys-cloud-chatbot-tester-cli)](https://www.npmjs.com/package/@makingchatbots/genesys-cloud-chatbot-tester-cli) [![Follow me on LinkedIn for updates](https://img.shields.io/badge/Follow%20for%20updat

28 lines (27 loc) 892 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.containsTerminatingPhrases = containsTerminatingPhrases; function containsTerminatingPhrases(subject, phrases) { const failurePhraseFound = phrases.fail.find((phrase) => subject.toUpperCase().includes(phrase.toUpperCase())); if (failurePhraseFound) { return { phraseFound: true, phraseIndicates: 'fail', phraseInSubject: failurePhraseFound, subject, }; } const passPhraseFound = phrases.pass.find((phrase) => subject.toUpperCase().includes(phrase.toUpperCase())); if (passPhraseFound) { return { phraseFound: true, phraseIndicates: 'pass', phraseInSubject: passPhraseFound, subject, }; } return { phraseFound: false, subject, }; }