botium-core 1.14.9 → 1.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,6 +49,57 @@ const echoConnectorMultipleBotMessages = ({ queueBotSays }) => {
49
49
  }
50
50
  }
51
51
 
52
+ const echoConnectorMultipleBotMessagesSkipAnOptional = ({ queueBotSays }) => {
53
+ return {
54
+ UserSays (msg) {
55
+ const botMsg = { sender: 'bot', sourceData: msg.sourceData, messageText: msg.messageText }
56
+ if (msg.messageText === 'Welcome') {
57
+ botMsg.messageText = 'Welcome'
58
+ queueBotSays(botMsg)
59
+
60
+ setTimeout(() => {
61
+ botMsg.messageText = ''
62
+ botMsg.buttons = [
63
+ { text: 'First Button' },
64
+ { text: 'Second Button' }
65
+ ]
66
+ queueBotSays(botMsg)
67
+ }, 200)
68
+ } else {
69
+ queueBotSays(botMsg)
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ const echoConnectorMultipleBotMessagesAssertionFailOnOptional = ({ queueBotSays }) => {
76
+ return {
77
+ UserSays (msg) {
78
+ const botMsg = { sender: 'bot', sourceData: msg.sourceData, messageText: msg.messageText }
79
+ if (msg.messageText === 'Welcome') {
80
+ botMsg.messageText = 'Welcome'
81
+ queueBotSays(botMsg)
82
+
83
+ setTimeout(() => {
84
+ botMsg.messageText = 'Fail on this:'
85
+ queueBotSays(botMsg)
86
+ }, 200)
87
+
88
+ setTimeout(() => {
89
+ botMsg.messageText = ''
90
+ botMsg.buttons = [
91
+ { text: 'First Button' },
92
+ { text: 'Second Button' }
93
+ ]
94
+ queueBotSays(botMsg)
95
+ }, 200)
96
+ } else {
97
+ queueBotSays(botMsg)
98
+ }
99
+ }
100
+ }
101
+ }
102
+
52
103
  describe('convo.transcript', function () {
53
104
  beforeEach(async function () {
54
105
  const myCaps = {
@@ -92,6 +143,26 @@ describe('convo.transcript', function () {
92
143
  this.compilerMultipleBotmessages = this.driverMultipleBotmessages.BuildCompiler()
93
144
  this.containerMultipleBotmessages = await this.driverMultipleBotmessages.Build()
94
145
  await this.containerMultipleBotmessages.Start()
146
+
147
+ const myCapsMultipleBotMessagesSkipAnOptional = {
148
+ [Capabilities.PROJECTNAME]: 'convo.transcript',
149
+ [Capabilities.CONTAINERMODE]: echoConnectorMultipleBotMessagesSkipAnOptional,
150
+ [Capabilities.SCRIPTING_FORCE_BOT_CONSUMED]: true
151
+ }
152
+ this.driverMultipleBotmessagesSkipAnOptional = new BotDriver(myCapsMultipleBotMessagesSkipAnOptional)
153
+ this.compilerMultipleBotmessagesSkipAnOptional = this.driverMultipleBotmessagesSkipAnOptional.BuildCompiler()
154
+ this.containerMultipleBotmessagesSkipAnOptional = await this.driverMultipleBotmessagesSkipAnOptional.Build()
155
+ await this.containerMultipleBotmessagesSkipAnOptional.Start()
156
+
157
+ const myCapsMultipleBotMessagesAssertionFailOnOptional = {
158
+ [Capabilities.PROJECTNAME]: 'convo.transcript',
159
+ [Capabilities.CONTAINERMODE]: echoConnectorMultipleBotMessagesAssertionFailOnOptional,
160
+ [Capabilities.SCRIPTING_FORCE_BOT_CONSUMED]: true
161
+ }
162
+ this.driverMultipleBotmessagesAssertionFailOnOptional = new BotDriver(myCapsMultipleBotMessagesAssertionFailOnOptional)
163
+ this.compilerMultipleBotmessagesAssertionFailOnOptional = this.driverMultipleBotmessagesAssertionFailOnOptional.BuildCompiler()
164
+ this.containerMultipleBotmessagesAssertionFailOnOptional = await this.driverMultipleBotmessagesAssertionFailOnOptional.Build()
165
+ await this.containerMultipleBotmessagesAssertionFailOnOptional.Start()
95
166
  })
96
167
  afterEach(async function () {
97
168
  await this.container.Stop()
@@ -189,13 +260,34 @@ describe('convo.transcript', function () {
189
260
  assert.isDefined(transcript)
190
261
  assert.equal(transcript.steps.length, 6)
191
262
  })
263
+ it('should provide transcript optional multiple bot steps on skip an optional bot messages', async function () {
264
+ this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'welcome_multiple_botsteps_opt.convo.txt')
265
+ assert.equal(this.compiler.convos.length, 1)
266
+
267
+ const transcript = await this.compiler.convos[0].Run(this.containerMultipleBotmessagesSkipAnOptional)
268
+ assert.isDefined(transcript)
269
+ assert.equal(transcript.steps.length, 5)
270
+ })
271
+ it('should provide transcript optional multiple bot steps assertion fail on optional bot messages', async function () {
272
+ this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'welcome_multiple_botsteps_opt.convo.txt')
273
+ assert.equal(this.compiler.convos.length, 1)
274
+
275
+ try {
276
+ await this.compiler.convos[0].Run(this.containerMultipleBotmessagesAssertionFailOnOptional)
277
+ assert.fail('expected error')
278
+ } catch (err) {
279
+ assert.isDefined(err.transcript)
280
+ assert.equal(err.transcript.steps.length, 3)
281
+ assert.isTrue(err.message.includes('Unexpected message'))
282
+ }
283
+ })
192
284
  it('should provide transcript optional multiple bot steps on not getting all bot messages', async function () {
193
285
  this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'welcome_multiple_botsteps_opt.convo.txt')
194
286
  assert.equal(this.compiler.convos.length, 1)
195
287
 
196
288
  const transcript = await this.compiler.convos[0].Run(this.container)
197
289
  assert.isDefined(transcript)
198
- assert.equal(transcript.steps.length, 6)
290
+ assert.equal(transcript.steps.length, 5)
199
291
  })
200
292
  it('should include pause in transcript steps', async function () {
201
293
  this.compiler.ReadScript(path.resolve(__dirname, 'convos'), '2stepsWithPause.convo.txt')
@@ -103,13 +103,11 @@ describe('customhooks.hookfromsrc', function () {
103
103
 
104
104
  const { container } = await buildDriver({
105
105
  [Capabilities.CUSTOMHOOK_ONSTART]: async ({ container, request }) => {
106
- return new Promise((resolve, reject) => {
107
- request({ method: 'get', uri: 'https://gettoken.com/get', json: true }, (err, response, body) => {
108
- if (err) return reject(err)
106
+ return fetch('https://gettoken.com/get')
107
+ .then(response => response.json())
108
+ .then(body => {
109
109
  container.caps.MYTOKEN = body.token
110
- resolve()
111
110
  })
112
- })
113
111
  }
114
112
  })
115
113
  await container.Start()
@@ -0,0 +1,21 @@
1
+ const Capabilities = require('../../index').Capabilities
2
+ const { normalizeText } = require('../../src/scripting/helper')
3
+ const assert = require('chai').assert
4
+
5
+ describe('scripting.helper', function () {
6
+ describe('NormalizeText', function () {
7
+ it('Basic', async function () {
8
+ assert.equal(normalizeText('Hello! <br>And this is the body!!!', { [Capabilities.SCRIPTING_NORMALIZE_TEXT]: true }), 'Hello! And this is the body!!!')
9
+ })
10
+
11
+ it('Remove specific characters', async function () {
12
+ // (,/,, +,-,//) -> ([",", "+", "-", "/"])
13
+ assert.equal(normalizeText('Hello,!+-/ <br>And this is the body!!!', { [Capabilities.SCRIPTING_NORMALIZE_TEXT_REMOVE_CHARACTERES]: ',/,, +,-,//' }), 'Hello! <br>And this is the body!!!')
14
+ })
15
+
16
+ it('Remove characters via multilang regex', async function () {
17
+ // remove all emojis, currency symbols, and "`" character
18
+ assert.equal(normalizeText('A ticket` to 大阪 costs ¥2000👌.', { [Capabilities.SCRIPTING_NORMALIZE_TEXT_REMOVE_REGEXP]: '[\\p{Emoji_Presentation}\\p{Currency_Symbol}`]' }), 'A ticket to 大阪 costs 2000.')
19
+ })
20
+ })
21
+ })
@@ -0,0 +1,105 @@
1
+ const Constants = require('../../../src/scripting/Constants')
2
+ const assert = require('chai').assert
3
+ const BotDriver = require('../../..').BotDriver
4
+ const Capabilities = require('../../..').Capabilities
5
+
6
+ const echoConnector = () => ({ queueBotSays }) => {
7
+ return {
8
+ UserSays (msg) {
9
+ const botMsg = { sender: 'bot', sourceData: msg.sourceData, messageText: msg.messageText }
10
+ queueBotSays(botMsg)
11
+ }
12
+ }
13
+ }
14
+
15
+ const buildDriver = async (mergeCaps) => {
16
+ const myCaps = Object.assign({
17
+ [Capabilities.PROJECTNAME]: 'convo.localvsglobal',
18
+ [Capabilities.CONTAINERMODE]: echoConnector()
19
+ }, mergeCaps)
20
+
21
+ const result = {}
22
+ result.driver = new BotDriver(myCaps)
23
+ result.compiler = result.driver.BuildCompiler()
24
+ result.container = await result.driver.Build()
25
+ return result
26
+ }
27
+
28
+ const convoScriptAsserters = `
29
+ LOCALVSGLOBAL
30
+
31
+ #me
32
+ hello
33
+
34
+ #bot
35
+
36
+ #me
37
+ hello 2
38
+
39
+ #bot
40
+ MYASSERTER
41
+ `
42
+
43
+ const convoScriptHooks = `
44
+ LOCALVSGLOBAL
45
+
46
+ #me
47
+ hello
48
+
49
+ #bot
50
+
51
+ #me
52
+ hello 2
53
+
54
+ #bot
55
+ MYHOOK
56
+ `
57
+
58
+ describe('Using local and global hooks together', function () {
59
+ it('should use local and global asserter', async function () {
60
+ let localAssertionCount = 0
61
+ let globalAssertionCount = 0
62
+
63
+ const { compiler, container } = await buildDriver({
64
+ [Capabilities.ASSERTERS]: [{
65
+ ref: 'MYASSERTER',
66
+ src: {
67
+ assertConvoStep: ({ isGlobal }) => {
68
+ if (isGlobal) globalAssertionCount++
69
+ else localAssertionCount++
70
+ return Promise.resolve()
71
+ }
72
+ },
73
+ global: true
74
+ }]
75
+ })
76
+
77
+ compiler.ReadScriptFromBuffer(Buffer.from(convoScriptAsserters), Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_CONVO)
78
+ await compiler.convos[0].Run(container)
79
+ assert.equal(localAssertionCount, 1)
80
+ assert.equal(globalAssertionCount, 1)
81
+ })
82
+ it('should use local and global logic hooks', async function () {
83
+ let localHookCount = 0
84
+ let globalHookCount = 0
85
+
86
+ const { compiler, container } = await buildDriver({
87
+ [Capabilities.LOGIC_HOOKS]: [{
88
+ ref: 'MYHOOK',
89
+ src: {
90
+ onBotEnd: ({ isGlobal }) => {
91
+ if (isGlobal) globalHookCount++
92
+ else localHookCount++
93
+ return Promise.resolve()
94
+ }
95
+ },
96
+ global: true
97
+ }]
98
+ })
99
+
100
+ compiler.ReadScriptFromBuffer(Buffer.from(convoScriptHooks), Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_CONVO)
101
+ await compiler.convos[0].Run(container)
102
+ assert.equal(localHookCount, 1)
103
+ assert.equal(globalHookCount, 1)
104
+ })
105
+ })
@@ -17,6 +17,7 @@ describe('scripting.scriptingProvider', function () {
17
17
  assert.isArray(convos)
18
18
  assert.equal(convos.length, 2)
19
19
  })
20
+
20
21
  it('should read multiple files from dir with globFilter', async function () {
21
22
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
22
23
  await scriptingProvider.Build()
@@ -25,6 +26,7 @@ describe('scripting.scriptingProvider', function () {
25
26
  assert.isArray(convos)
26
27
  assert.equal(convos.length, 2)
27
28
  })
29
+
28
30
  it('should ignore files from dir with globFilter', async function () {
29
31
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
30
32
  await scriptingProvider.Build()
@@ -33,6 +35,7 @@ describe('scripting.scriptingProvider', function () {
33
35
  assert.isArray(convos)
34
36
  assert.equal(convos.length, 0)
35
37
  })
38
+
36
39
  it('should read single file from file path', async function () {
37
40
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
38
41
  await scriptingProvider.Build()
@@ -41,6 +44,7 @@ describe('scripting.scriptingProvider', function () {
41
44
  assert.isArray(convos)
42
45
  assert.equal(convos.length, 1)
43
46
  })
47
+
44
48
  it('should skip convos', async function () {
45
49
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
46
50
  await scriptingProvider.Build()
@@ -68,6 +72,7 @@ describe('scripting.scriptingProvider', function () {
68
72
  assert.equal(tomatch[1], 'TEXT2')
69
73
  scriptingContext.scriptingEvents.assertBotResponse('TEXT1', tomatch, 'test1', null, {})
70
74
  })
75
+
71
76
  it('should resolve multiple utterance', async function () {
72
77
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
73
78
  await scriptingProvider.Build()
@@ -93,6 +98,7 @@ describe('scripting.scriptingProvider', function () {
93
98
  assert.equal(tomatchUtt2[0], 'TEXT3')
94
99
  assert.equal(tomatchUtt2[1], 'TEXT4')
95
100
  })
101
+
96
102
  it('should resolve null on invalid utterance', async function () {
97
103
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
98
104
  await scriptingProvider.Build()
@@ -108,6 +114,7 @@ describe('scripting.scriptingProvider', function () {
108
114
  })
109
115
  assert.isNull(tomatch)
110
116
  })
117
+
111
118
  it('should fail on invalid utterance', async function () {
112
119
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
113
120
  await scriptingProvider.Build()
@@ -133,6 +140,7 @@ describe('scripting.scriptingProvider', function () {
133
140
  assert.equal(err.context.cause.actual, 'TEXT1')
134
141
  }
135
142
  })
143
+
136
144
  it('should fail on unresolved utterance', async function () {
137
145
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
138
146
  await scriptingProvider.Build()
@@ -153,6 +161,7 @@ describe('scripting.scriptingProvider', function () {
153
161
  assert.equal(err.context.cause.actual, 'TEXT1')
154
162
  }
155
163
  })
164
+
156
165
  it('should resolve and format utterance args', async function () {
157
166
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
158
167
  await scriptingProvider.Build()
@@ -169,6 +178,7 @@ describe('scripting.scriptingProvider', function () {
169
178
  assert.equal(tomatch[1], 'TEXT2 hello')
170
179
  scriptingContext.scriptingEvents.assertBotResponse('TEXT1 hello', tomatch, 'test1', null, {})
171
180
  })
181
+
172
182
  it('should resolve and append utterance args', async function () {
173
183
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
174
184
  await scriptingProvider.Build()
@@ -246,6 +256,7 @@ describe('scripting.scriptingProvider', function () {
246
256
  const scriptingProvider = new ScriptingProvider()
247
257
  assert.equal(scriptingProvider._isValidAsserterType('assertConvoStep'), true)
248
258
  })
259
+
249
260
  it('invalid asserterType', async function () {
250
261
  const scriptingProvider = new ScriptingProvider()
251
262
  assert.equal(scriptingProvider._isValidAsserterType('assertStep'), false)
@@ -294,6 +305,7 @@ describe('scripting.scriptingProvider', function () {
294
305
  assert.equal(scriptingProvider.convos[1].header.name, 'test convo/utt1-L2')
295
306
  assert.equal(scriptingProvider.convos[1].conversation[0].messageText, 'TEXT2')
296
307
  })
308
+
297
309
  it('should build convos for utterance using iterator', async function () {
298
310
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
299
311
  await scriptingProvider.Build()
@@ -336,6 +348,7 @@ describe('scripting.scriptingProvider', function () {
336
348
  // assert.deepEqual(iteratedConvo, expected[index])
337
349
  // })
338
350
  })
351
+
339
352
  it('should build convos for utterance with parameters', async function () {
340
353
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
341
354
  await scriptingProvider.Build()
@@ -364,6 +377,7 @@ describe('scripting.scriptingProvider', function () {
364
377
  assert.equal(scriptingProvider.convos[1].header.name, 'test convo/utt1-L2')
365
378
  assert.equal(scriptingProvider.convos[1].conversation[0].messageText, 'TEXT2 arg0 1')
366
379
  })
380
+
367
381
  it('should build convos for utterance with whitespace', async function () {
368
382
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
369
383
  await scriptingProvider.Build()
@@ -392,6 +406,7 @@ describe('scripting.scriptingProvider', function () {
392
406
  assert.equal(scriptingProvider.convos[1].header.name, 'test convo/utt with some whitespace-L2')
393
407
  assert.equal(scriptingProvider.convos[1].conversation[0].messageText, 'TEXT2')
394
408
  })
409
+
395
410
  describe('should build convos for SCRIPTING_UTTEXPANSION_NAMING_MODE', function () {
396
411
  const utterances = [
397
412
  {
@@ -442,6 +457,7 @@ describe('scripting.scriptingProvider', function () {
442
457
  assert.equal(scriptingProvider.convos[0].header.name, 'test convo/uttText-L1-TEXT1 0123456...')
443
458
  assert.equal(scriptingProvider.convos[1].header.name, 'test convo/uttText-L2-TEXT2 0123456...')
444
459
  })
460
+
445
461
  it('SCRIPTING_UTTEXPANSION_NAMING_MODE=utterance len=1', async function () {
446
462
  const scriptingProvider = new ScriptingProvider(Object.assign(
447
463
  {},
@@ -474,6 +490,7 @@ describe('scripting.scriptingProvider', function () {
474
490
  assert.equal(scriptingProvider.convos[0].conversation.length, 1)
475
491
  assert.equal(scriptingProvider.convos[0].header.name, 'test convo')
476
492
  })
493
+
477
494
  it('SCRIPTING_UTTEXPANSION_NAMING_MODE=utterance, turn length off', async function () {
478
495
  const scriptingProvider = new ScriptingProvider(Object.assign(
479
496
  {},
@@ -513,6 +530,7 @@ describe('scripting.scriptingProvider', function () {
513
530
  assert.equal(scriptingProvider.convos[0].header.name, 'test convo/uttText-L1-TEXT1 0...')
514
531
  assert.equal(scriptingProvider.convos[1].header.name, 'test convo/uttText-L2-TEXT2 0...')
515
532
  })
533
+
516
534
  it('SCRIPTING_UTTEXPANSION_NAMING_MODE=utterance userinputs', async function () {
517
535
  const scriptingProvider = new ScriptingProvider(Object.assign(
518
536
  {},
@@ -551,6 +569,7 @@ describe('scripting.scriptingProvider', function () {
551
569
  assert.equal(scriptingProvider.convos[1].header.name, 'test convo/MEDIA-L2-test2 0123456...')
552
570
  assert.equal(scriptingProvider.convos[2].header.name, 'test convo/MEDIA-L3-test3.jpg')
553
571
  })
572
+
554
573
  it('SCRIPTING_UTTEXPANSION_NAMING_MODE=utterance userinputs len=1', async function () {
555
574
  const scriptingProvider = new ScriptingProvider(Object.assign(
556
575
  {},
@@ -587,6 +606,7 @@ describe('scripting.scriptingProvider', function () {
587
606
  assert.equal(scriptingProvider.convos[0].conversation.length, 1)
588
607
  assert.equal(scriptingProvider.convos[0].header.name, 'test convo')
589
608
  })
609
+
590
610
  it('SCRIPTING_UTTEXPANSION_NAMING_MODE=utterance userinputs and utterances', async function () {
591
611
  const scriptingProvider = new ScriptingProvider(Object.assign(
592
612
  {},
@@ -630,6 +650,7 @@ describe('scripting.scriptingProvider', function () {
630
650
  assert.equal(scriptingProvider.convos[4].header.name, 'test convo/uttText-L2-TEXT2 0123456...')
631
651
  })
632
652
  })
653
+
633
654
  describe('should have be possible to generate / store convos partially', function () {
634
655
  const _createConvos = async () => {
635
656
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
@@ -720,6 +741,7 @@ describe('scripting.scriptingProvider', function () {
720
741
  assert.equal(scriptingProvider.convos[1].conversation[0].messageText, 'TEXT2')
721
742
  assert.equal(scriptingProvider.convos[1].toString(), '2 utt1/utt1-L00002 (Expanded Utterances - utt1) ({ origUttName: \'utt1\', origConvoName: \'utt1\' }): Step 1 - tell utterance: #me - TEXT2 SKIP_BOT_UNCONSUMED(no args) | Step 2 - check bot response: #bot - ')
722
743
  }).timeout(5000)
744
+
723
745
  it('should build incomprehension convos for utterance', async function () {
724
746
  const scriptingProvider = new ScriptingProvider(Object.assign({}, DefaultCapabilities, { SCRIPTING_UTTEXPANSION_INCOMPREHENSION: 'INCOMPREHENSION' }))
725
747
  await scriptingProvider.Build()
@@ -750,6 +772,7 @@ describe('scripting.scriptingProvider', function () {
750
772
  assert.equal(scriptingProvider.convos[1].conversation[1].messageText, 'INCOMPREHENSION')
751
773
  assert.equal(scriptingProvider.convos[1].conversation[1].not, true)
752
774
  })
775
+
753
776
  it('should build intent check convos for utterance', async function () {
754
777
  const scriptingProvider = new ScriptingProvider(Object.assign({}, DefaultCapabilities, { SCRIPTING_UTTEXPANSION_USENAMEASINTENT: true }))
755
778
  await scriptingProvider.Build()
@@ -779,6 +802,7 @@ describe('scripting.scriptingProvider', function () {
779
802
  assert.equal(scriptingProvider.convos[1].conversation[1].asserters[0].name, 'INTENT')
780
803
  assert.equal(scriptingProvider.convos[1].conversation[1].asserters[0].args[0], 'utt1')
781
804
  })
805
+
782
806
  it('should build intent check convos for utterance (with arg)', async function () {
783
807
  const scriptingProvider = new ScriptingProvider(Object.assign({}, DefaultCapabilities))
784
808
  await scriptingProvider.Build()
@@ -808,6 +832,7 @@ describe('scripting.scriptingProvider', function () {
808
832
  assert.equal(scriptingProvider.convos[1].conversation[1].asserters[0].name, 'INTENT')
809
833
  assert.equal(scriptingProvider.convos[1].conversation[1].asserters[0].args[0], 'utt1')
810
834
  })
835
+
811
836
  it('should build check-only convos for utterance', async function () {
812
837
  const scriptingProvider = new ScriptingProvider(Object.assign({}, DefaultCapabilities))
813
838
  await scriptingProvider.Build()
@@ -834,6 +859,7 @@ describe('scripting.scriptingProvider', function () {
834
859
  assert.equal(scriptingProvider.convos[1].conversation[1].messageText, '')
835
860
  assert.isFalse(scriptingProvider.convos[1].conversation[1].not)
836
861
  })
862
+
837
863
  it('should fail incomprehension convos for utterance without incomprehension utt', async function () {
838
864
  const scriptingProvider = new ScriptingProvider(Object.assign({}, DefaultCapabilities, { SCRIPTING_UTTEXPANSION_INCOMPREHENSION: 'INCOMPREHENSION' }))
839
865
  await scriptingProvider.Build()
@@ -845,6 +871,7 @@ describe('scripting.scriptingProvider', function () {
845
871
  assert.isTrue(err.message.indexOf('incomprehension utterance \'INCOMPREHENSION\' undefined') > 0)
846
872
  }
847
873
  })
874
+
848
875
  it('should add incomprehension utterances to new utterance list', async function () {
849
876
  const scriptingProvider = new ScriptingProvider(Object.assign({}, DefaultCapabilities))
850
877
  await scriptingProvider.Build()
@@ -856,6 +883,7 @@ describe('scripting.scriptingProvider', function () {
856
883
  scriptingProvider.ExpandUtterancesToConvos({ incomprehensionUtt: 'INCOMPREHENSION', incomprehensionUtts: ['INCOMPREHENSION3', 'INCOMPREHENSION4'] })
857
884
  assert.lengthOf(scriptingProvider.utterances.INCOMPREHENSION.utterances, 2)
858
885
  })
886
+
859
887
  it('should add incomprehension utterances to new default utterance list', async function () {
860
888
  const scriptingProvider = new ScriptingProvider(Object.assign({}, DefaultCapabilities))
861
889
  await scriptingProvider.Build()
@@ -867,6 +895,7 @@ describe('scripting.scriptingProvider', function () {
867
895
  scriptingProvider.ExpandUtterancesToConvos({ incomprehensionUtts: ['INCOMPREHENSION3', 'INCOMPREHENSION4'] })
868
896
  assert.lengthOf(scriptingProvider.utterances.UTT_INCOMPREHENSION.utterances, 2)
869
897
  })
898
+
870
899
  it('should add incomprehension utterances to existing utterance list', async function () {
871
900
  const scriptingProvider = new ScriptingProvider(Object.assign({}, DefaultCapabilities))
872
901
  await scriptingProvider.Build()
@@ -882,6 +911,7 @@ describe('scripting.scriptingProvider', function () {
882
911
  scriptingProvider.ExpandUtterancesToConvos({ incomprehensionUtt: 'INCOMPREHENSION', incomprehensionUtts: ['INCOMPREHENSION3', 'INCOMPREHENSION4'] })
883
912
  assert.lengthOf(scriptingProvider.utterances.INCOMPREHENSION.utterances, 4)
884
913
  })
914
+
885
915
  it('should add incomprehension intent to asserter list', async function () {
886
916
  const scriptingProvider = new ScriptingProvider(Object.assign({}, DefaultCapabilities))
887
917
  await scriptingProvider.Build()
@@ -916,6 +946,7 @@ describe('scripting.scriptingProvider', function () {
916
946
  assert.equal(err.message, 'test1: Bot response "actual" expected to match "expected"')
917
947
  }
918
948
  })
949
+
919
950
  it('should fail with correct error message on empty bot message', async function () {
920
951
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
921
952
  await scriptingProvider.Build()
@@ -927,6 +958,7 @@ describe('scripting.scriptingProvider', function () {
927
958
  assert.equal(err.message, 'test1: Bot response <no response> expected to match "expected"')
928
959
  }
929
960
  })
961
+
930
962
  it('should fail with correct error message on multiple tomatch', async function () {
931
963
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
932
964
  await scriptingProvider.Build()
@@ -952,6 +984,7 @@ describe('scripting.scriptingProvider', function () {
952
984
  assert.equal(err.message, 'test1: Bot response "Keine Antwort gefunden!" expected NOT to match "Keine Antwort gefunden"')
953
985
  }
954
986
  })
987
+
955
988
  it('should fail with correct error message on by empty asserter', async function () {
956
989
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
957
990
  await scriptingProvider.Build()
@@ -963,6 +996,7 @@ describe('scripting.scriptingProvider', function () {
963
996
  assert.equal(err.message, 'test1: Bot response "Keine Antwort gefunden!" expected NOT to match <any response>')
964
997
  }
965
998
  })
999
+
966
1000
  it('should fail with correct error message on by empty asserter, and empty bot response', async function () {
967
1001
  const scriptingProvider = new ScriptingProvider(DefaultCapabilities)
968
1002
  await scriptingProvider.Build()