botium-core 1.13.0 → 1.13.3

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.
Files changed (57) hide show
  1. package/.eslintrc.js +6 -3
  2. package/dist/botium-cjs.js +305 -123
  3. package/dist/botium-cjs.js.map +1 -1
  4. package/dist/botium-es.js +323 -142
  5. package/dist/botium-es.js.map +1 -1
  6. package/package.json +17 -15
  7. package/src/Capabilities.js +2 -1
  8. package/src/containers/plugins/SimpleRestContainer.js +23 -16
  9. package/src/grid/inbound/proxy.js +2 -1
  10. package/src/helpers/RetryHelper.js +13 -7
  11. package/src/scripting/Convo.js +36 -10
  12. package/src/scripting/MatchFunctions.js +10 -0
  13. package/src/scripting/ScriptingProvider.js +106 -37
  14. package/src/scripting/logichook/LogicHookConsts.js +1 -1
  15. package/src/scripting/logichook/LogicHookUtils.js +1 -1
  16. package/src/scripting/logichook/asserter/WerAsserter.js +59 -0
  17. package/src/scripting/logichook/logichooks/UpdateCustomLogicHook.js +3 -2
  18. package/test/compiler/compilercsv.spec.js +104 -3
  19. package/test/compiler/compilerjson.spec.js +0 -2
  20. package/test/compiler/compilerxlsx.spec.js +1 -1
  21. package/test/compiler/convos/csv/utterances_liveperson2.csv +12 -0
  22. package/test/connectors/simplerest.spec.js +1012 -969
  23. package/test/convo/fillAndApplyScriptingMemory.spec.js +804 -785
  24. package/test/convo/partialconvo.spec.js +345 -339
  25. package/test/convo/retryconvo.spec.js +134 -0
  26. package/test/driver/capabilities.spec.js +156 -151
  27. package/test/logichooks/hookfromsrc.spec.js +79 -73
  28. package/test/plugins/plugins.spec.js +44 -42
  29. package/test/scripting/asserters/buttonsAsserter.spec.js +257 -240
  30. package/test/scripting/asserters/cardsAsserter.spec.js +214 -212
  31. package/test/scripting/asserters/convos/wer_threshold_nok.yml +7 -0
  32. package/test/scripting/asserters/convos/wer_threshold_ok.yml +7 -0
  33. package/test/scripting/asserters/intentConfidenceAsserter.spec.js +34 -35
  34. package/test/scripting/asserters/jsonpathAsserter.spec.js +307 -308
  35. package/test/scripting/asserters/mediaAsserter.spec.js +236 -234
  36. package/test/scripting/asserters/werAsserter.spec.js +51 -0
  37. package/test/scripting/logichooks/setClearScriptingMemory.spec.js +202 -192
  38. package/test/scripting/matching/matchingmode.spec.js +306 -258
  39. package/test/scripting/scriptingProvider.spec.js +666 -633
  40. package/test/scripting/scriptingmemory/fillScriptingMemoryFromFile.spec.js +299 -281
  41. package/test/scripting/scriptingmemory/useScriptingMemoryForAssertion.spec.js +94 -80
  42. package/test/scripting/userinputs/defaultUserInputs.spec.js +233 -127
  43. package/test/scripting/userinputs/mediaInputConvos.spec.js +409 -403
  44. package/test/scripting/utteranceexpansion/associateByIndex.spec.js +259 -0
  45. package/test/scripting/utteranceexpansion/convos/associate_utterances_by_index.json +33 -0
  46. package/test/scripting/utteranceexpansion/convos/media.convo.txt +19 -0
  47. package/test/scripting/utteranceexpansion/files/step0voice0.wav +0 -0
  48. package/test/scripting/utteranceexpansion/files/step0voice1.wav +0 -0
  49. package/test/scripting/utteranceexpansion/files/step0voice2.wav +0 -0
  50. package/test/scripting/utteranceexpansion/files/step1voice0.wav +0 -0
  51. package/test/scripting/utteranceexpansion/files/step2voice0.wav +0 -0
  52. package/test/scripting/utteranceexpansion/files/step2voice1.wav +0 -0
  53. package/test/scripting/utteranceexpansion/files/step2voice2.wav +0 -0
  54. package/test/scripting/utteranceexpansion/files/step2voice4.wav +0 -0
  55. package/test/scripting/utteranceexpansion/files/step2voice5.wav +0 -0
  56. package/test/security/allowUnsafe.spec.js +274 -268
  57. package/test/utils.spec.js +40 -38
@@ -30,322 +30,328 @@ const emptyMsg = {}
30
30
  const functionConnector = ({ queueBotSays }) => {
31
31
  return {
32
32
  UserSays (msg) {
33
- const botMsg = { sender: 'bot', sourceData: msg.sourceData, messageText: `Response of ${msg.messageText}` }
33
+ const botMsg = {
34
+ sender: 'bot',
35
+ sourceData: msg.sourceData,
36
+ messageText: `Response of ${msg.messageText}`
37
+ }
34
38
  queueBotSays(botMsg)
35
39
  }
36
40
  }
37
41
  }
38
42
 
39
- describe('hook utils', function () {
40
- it('should accept string hook in safe mode', async function () {
41
- HookUtils.getHook({
42
- [Capabilities.SECURITY_ALLOW_UNSAFE]: false
43
- }, '1+1')
44
- })
45
- it('should accept javascript hook in safe mode', async function () {
46
- HookUtils.getHook({
47
- [Capabilities.SECURITY_ALLOW_UNSAFE]: false
48
- }, () => null)
49
- })
50
- it('should not accept file hook in safe mode', async function () {
51
- try {
43
+ describe('security.allowUnsafe', function () {
44
+ describe('hook utils', function () {
45
+ it('should accept string hook in safe mode', async function () {
52
46
  HookUtils.getHook({
53
47
  [Capabilities.SECURITY_ALLOW_UNSAFE]: false
48
+ }, '1+1')
49
+ })
50
+ it('should accept javascript hook in safe mode', async function () {
51
+ HookUtils.getHook({
52
+ [Capabilities.SECURITY_ALLOW_UNSAFE]: false
53
+ }, () => null)
54
+ })
55
+ it('should not accept file hook in safe mode', async function () {
56
+ try {
57
+ HookUtils.getHook({
58
+ [Capabilities.SECURITY_ALLOW_UNSAFE]: false
59
+ }, 'test/security/resources/hook-as-file.js')
60
+ assert.fail('should have failed')
61
+ } catch (err) {
62
+ assert.isTrue(err instanceof BotiumError)
63
+ assert.exists(err.context)
64
+ assert.equal(err.context.message, 'Security Error. Using unsafe custom hook with require is not allowed')
65
+ assert.equal(err.context.source, 'HookUtils.js')
66
+ assert.equal(err.context.type, 'security')
67
+ assert.equal(err.context.subtype, 'allow unsafe')
68
+ assert.exists(err.context.cause)
69
+ assert.equal(err.context.cause.hookData, 'test/security/resources/hook-as-file.js')
70
+ }
71
+ })
72
+ it('should accept file hook in unsafe mode', async function () {
73
+ HookUtils.getHook({
74
+ [Capabilities.SECURITY_ALLOW_UNSAFE]: true
54
75
  }, 'test/security/resources/hook-as-file.js')
55
- assert.fail('should have failed')
56
- } catch (err) {
57
- assert.isTrue(err instanceof BotiumError)
58
- assert.exists(err.context)
59
- assert.equal(err.context.message, 'Security Error. Using unsafe custom hook with require is not allowed')
60
- assert.equal(err.context.source, 'HookUtils.js')
61
- assert.equal(err.context.type, 'security')
62
- assert.equal(err.context.subtype, 'allow unsafe')
63
- assert.exists(err.context.cause)
64
- assert.equal(err.context.cause.hookData, 'test/security/resources/hook-as-file.js')
65
- }
66
- })
67
- it('should accept file hook in unsafe mode', async function () {
68
- HookUtils.getHook({
69
- [Capabilities.SECURITY_ALLOW_UNSAFE]: true
70
- }, 'test/security/resources/hook-as-file.js')
71
- })
72
- it('should accept require hook in unsafe mode', async function () {
73
- HookUtils.getHook({
74
- [Capabilities.SECURITY_ALLOW_UNSAFE]: true
75
- }, 'hook-as-file')
76
+ })
77
+ it('should accept require hook in unsafe mode', async function () {
78
+ HookUtils.getHook({
79
+ [Capabilities.SECURITY_ALLOW_UNSAFE]: true
80
+ }, 'hook-as-file')
81
+ })
76
82
  })
77
- })
78
83
 
79
- describe('scripting memory', function () {
80
- it('should not throw security error for using inline function', async function () {
81
- const driver = new BotDriver(myCapsSimpleRest)
82
- const compiler = driver.BuildCompiler()
83
- const container = await driver.Build()
84
- await container.Start()
85
-
86
- try {
87
- compiler.ReadScript(path.resolve(__dirname, 'convos'), 'withscriptingmemoryfunction.convo.txt')
88
- await compiler.convos[0].Run(container)
89
- assert.fail('should have failed')
90
- } catch (err) {
91
- assert.isFalse(err.message.indexOf('Security Error. Using unsafe scripting memory function $func is not allowed') >= 0)
92
- }
93
- await container.Clean()
84
+ describe('scripting memory', function () {
85
+ it('should not throw security error for using inline function', async function () {
86
+ const driver = new BotDriver(myCapsSimpleRest)
87
+ const compiler = driver.BuildCompiler()
88
+ const container = await driver.Build()
89
+ await container.Start()
90
+
91
+ try {
92
+ compiler.ReadScript(path.resolve(__dirname, 'convos'), 'withscriptingmemoryfunction.convo.txt')
93
+ await compiler.convos[0].Run(container)
94
+ assert.fail('should have failed')
95
+ } catch (err) {
96
+ assert.isFalse(err.message.indexOf('Security Error. Using unsafe scripting memory function $func is not allowed') >= 0)
97
+ }
98
+ await container.Clean()
99
+ })
94
100
  })
95
- })
96
101
 
97
- describe('simple rest, scripting memory', function () {
98
- it('should use variables succesful', async function () {
99
- const myCaps = _getSimpleRestCaps(
100
- {
101
- [Capabilities.SIMPLEREST_BODY_TEMPLATE]: {
102
- FUNCTION_WITHOUT_PARAM: '{{fnc.year}}'
102
+ describe('simple rest, scripting memory', function () {
103
+ it('should use variables succesful', async function () {
104
+ const myCaps = _getSimpleRestCaps(
105
+ {
106
+ [Capabilities.SIMPLEREST_BODY_TEMPLATE]: {
107
+ FUNCTION_WITHOUT_PARAM: '{{fnc.year}}'
108
+ }
103
109
  }
104
- }
105
- )
106
- const driver = new BotDriver(myCaps)
107
- const container = await driver.Build()
108
- await container.Start()
110
+ )
111
+ const driver = new BotDriver(myCaps)
112
+ const container = await driver.Build()
113
+ await container.Start()
109
114
 
110
- await container.pluginInstance._buildRequest(emptyMsg)
115
+ await container.pluginInstance._buildRequest(emptyMsg)
111
116
 
112
- await container.Clean()
113
- })
117
+ await container.Clean()
118
+ })
114
119
 
115
- it('should use env variables succesful', async function () {
116
- const driver = new BotDriver(_getSimpleRestCaps(
117
- {
118
- [Capabilities.SIMPLEREST_BODY_TEMPLATE]: {
119
- SAMPLE_ENV: '{{#fnc.env}}SAMPLE_ENV{{/fnc.env}}'
120
+ it('should use env variables succesful', async function () {
121
+ const driver = new BotDriver(_getSimpleRestCaps(
122
+ {
123
+ [Capabilities.SIMPLEREST_BODY_TEMPLATE]: {
124
+ SAMPLE_ENV: '{{#fnc.env}}SAMPLE_ENV{{/fnc.env}}'
125
+ }
120
126
  }
121
- }
122
- ))
123
- const container = await driver.Build()
124
- await container.Start()
127
+ ))
128
+ const container = await driver.Build()
129
+ await container.Start()
125
130
 
126
- await container.pluginInstance._buildRequest(emptyMsg)
131
+ await container.pluginInstance._buildRequest(emptyMsg)
127
132
 
128
- await container.Clean()
133
+ await container.Clean()
134
+ })
129
135
  })
130
- })
131
136
 
132
- describe('simple rest, hooks', function () {
133
- it('should create and use simplerest with javascript hook', async function () {
134
- const driver = new BotDriver(_getSimpleRestCaps(
135
- {
136
- [Capabilities.SIMPLEREST_REQUEST_HOOK]: '1+1'
137
- }
138
- ))
137
+ describe('simple rest, hooks', function () {
138
+ it('should create and use simplerest with javascript hook', async function () {
139
+ const driver = new BotDriver(_getSimpleRestCaps(
140
+ {
141
+ [Capabilities.SIMPLEREST_REQUEST_HOOK]: '1+1'
142
+ }
143
+ ))
139
144
 
140
- const compiler = driver.BuildCompiler()
141
- const container = await driver.Build()
142
- await container.Start()
145
+ const compiler = driver.BuildCompiler()
146
+ const container = await driver.Build()
147
+ await container.Start()
143
148
 
144
- compiler.ReadScript(path.resolve(__dirname, 'convos'), 'dummy.convo.txt')
145
- })
146
- it('should create and use simplerest with function hooks', async function () {
147
- const driver = new BotDriver(_getSimpleRestCaps(
148
- {
149
- [Capabilities.SIMPLEREST_REQUEST_HOOK]: () => 2
150
- }
151
- ))
149
+ compiler.ReadScript(path.resolve(__dirname, 'convos'), 'dummy.convo.txt')
150
+ })
151
+ it('should create and use simplerest with function hooks', async function () {
152
+ const driver = new BotDriver(_getSimpleRestCaps(
153
+ {
154
+ [Capabilities.SIMPLEREST_REQUEST_HOOK]: () => 2
155
+ }
156
+ ))
152
157
 
153
- const compiler = driver.BuildCompiler()
154
- const container = await driver.Build()
155
- await container.Start()
158
+ const compiler = driver.BuildCompiler()
159
+ const container = await driver.Build()
160
+ await container.Start()
156
161
 
157
- compiler.ReadScript(path.resolve(__dirname, 'convos'), 'dummy.convo.txt')
162
+ compiler.ReadScript(path.resolve(__dirname, 'convos'), 'dummy.convo.txt')
163
+ })
158
164
  })
159
- })
160
165
 
161
- describe('precompilers', function () {
162
- it('should not throw security error for inline script type', async function () {
163
- const driver = new BotDriver(_getSimpleRestCaps(
164
- {
165
- [Capabilities.PRECOMPILERS]: {
166
- NAME: 'SCRIPT',
167
- SCRIPT: '1+1'
166
+ describe('precompilers', function () {
167
+ it('should not throw security error for inline script type', async function () {
168
+ const driver = new BotDriver(_getSimpleRestCaps(
169
+ {
170
+ [Capabilities.PRECOMPILERS]: {
171
+ NAME: 'SCRIPT',
172
+ SCRIPT: '1+1'
173
+ }
168
174
  }
169
- }
170
- ))
171
-
172
- const compiler = driver.BuildCompiler()
173
- const container = await driver.Build()
174
- const fileName = 'dummy.convo.txt'
175
- compiler.ReadScript(path.resolve(__dirname, 'convos'), fileName)
176
- assert.equal(compiler.convos.length, 1)
177
- await container.Clean()
175
+ ))
176
+
177
+ const compiler = driver.BuildCompiler()
178
+ const container = await driver.Build()
179
+ const fileName = 'dummy.convo.txt'
180
+ compiler.ReadScript(path.resolve(__dirname, 'convos'), fileName)
181
+ assert.equal(compiler.convos.length, 1)
182
+ await container.Clean()
183
+ })
178
184
  })
179
- })
180
185
 
181
- describe('base container, hooks', function () {
182
- it('should not throw security error for using inline hook', async function () {
183
- const driver = new BotDriver(_getSimpleRestCaps(
184
- { [Capabilities.CUSTOMHOOK_ONUSERSAYS]: '1+1' }
185
- ))
186
- await driver.Build()
186
+ describe('base container, hooks', function () {
187
+ it('should not throw security error for using inline hook', async function () {
188
+ const driver = new BotDriver(_getSimpleRestCaps(
189
+ { [Capabilities.CUSTOMHOOK_ONUSERSAYS]: '1+1' }
190
+ ))
191
+ await driver.Build()
192
+ })
187
193
  })
188
- })
189
194
 
190
- describe('logic hook, asserter', function () {
191
- it('should load asserter from file', async function () {
192
- const driver = new BotDriver(_getSimpleRestCaps(
193
- {
194
- [Capabilities.ASSERTERS]: [
195
- {
196
- ref: 'as-file'
197
- }
198
- ]
199
- }
200
- ))
195
+ describe('logic hook, asserter', function () {
196
+ it('should load asserter from file', async function () {
197
+ const driver = new BotDriver(_getSimpleRestCaps(
198
+ {
199
+ [Capabilities.ASSERTERS]: [
200
+ {
201
+ ref: 'as-file'
202
+ }
203
+ ]
204
+ }
205
+ ))
201
206
 
202
- driver.BuildCompiler()
203
- })
204
- it('should not throw security error for logic hook with inline src', async function () {
205
- const driver = new BotDriver(_getSimpleRestCaps(
206
- {
207
- [Capabilities.LOGIC_HOOKS]: [
208
- {
209
- ref: 'MY-LOGICHOOK-NAME',
210
- src: {
211
- onMeStart: '1+1'
212
- },
213
- global: false,
214
- args: {
215
- 'my-arg-1': 'something'
207
+ driver.BuildCompiler()
208
+ })
209
+ it('should not throw security error for logic hook with inline src', async function () {
210
+ const driver = new BotDriver(_getSimpleRestCaps(
211
+ {
212
+ [Capabilities.LOGIC_HOOKS]: [
213
+ {
214
+ ref: 'MY-LOGICHOOK-NAME',
215
+ src: {
216
+ onMeStart: '1+1'
217
+ },
218
+ global: false,
219
+ args: {
220
+ 'my-arg-1': 'something'
221
+ }
216
222
  }
217
- }
218
- ]
219
- }
220
- ))
223
+ ]
224
+ }
225
+ ))
221
226
 
222
- driver.BuildCompiler()
223
- })
224
- it('should not throw security error for global logic hook with inline src', async function () {
225
- const driver = new BotDriver(_getSimpleRestCaps(
226
- {
227
- [Capabilities.LOGIC_HOOKS]: [
228
- {
229
- ref: 'MY-LOGICHOOK-NAME',
230
- src: {
231
- onMeStart: '1+1'
232
- },
233
- global: true,
234
- args: {
235
- 'my-arg-1': 'something'
227
+ driver.BuildCompiler()
228
+ })
229
+ it('should not throw security error for global logic hook with inline src', async function () {
230
+ const driver = new BotDriver(_getSimpleRestCaps(
231
+ {
232
+ [Capabilities.LOGIC_HOOKS]: [
233
+ {
234
+ ref: 'MY-LOGICHOOK-NAME',
235
+ src: {
236
+ onMeStart: '1+1'
237
+ },
238
+ global: true,
239
+ args: {
240
+ 'my-arg-1': 'something'
241
+ }
236
242
  }
237
- }
238
- ]
239
- }
240
- ))
241
- driver.BuildCompiler()
243
+ ]
244
+ }
245
+ ))
246
+ driver.BuildCompiler()
247
+ })
242
248
  })
243
- })
244
249
 
245
- describe('connectors', function () {
246
- it('should create simplerest', async function () {
247
- const driver = new BotDriver(myCapsSimpleRest)
248
- await driver.Build()
249
- })
250
+ describe('connectors', function () {
251
+ it('should create simplerest', async function () {
252
+ const driver = new BotDriver(myCapsSimpleRest)
253
+ await driver.Build()
254
+ })
250
255
 
251
- it('should create any connector from file/dir with added botium-connector prefix', async function () {
252
- const driver = new BotDriver({
253
- [Capabilities.CONTAINERMODE]: 'as-file',
254
- [Capabilities.SECURITY_ALLOW_UNSAFE]: false
256
+ it('should create any connector from file/dir with added botium-connector prefix', async function () {
257
+ const driver = new BotDriver({
258
+ [Capabilities.CONTAINERMODE]: 'as-file',
259
+ [Capabilities.SECURITY_ALLOW_UNSAFE]: false
260
+ })
261
+ await driver.Build()
255
262
  })
256
- await driver.Build()
257
- })
258
263
 
259
- it('should create any connector from file/dir, if its starts with botium-connector prefix', async function () {
260
- const driver = new BotDriver({
261
- [Capabilities.CONTAINERMODE]: 'botium-connector-as-file',
262
- [Capabilities.SECURITY_ALLOW_UNSAFE]: false
264
+ it('should create any connector from file/dir, if its starts with botium-connector prefix', async function () {
265
+ const driver = new BotDriver({
266
+ [Capabilities.CONTAINERMODE]: 'botium-connector-as-file',
267
+ [Capabilities.SECURITY_ALLOW_UNSAFE]: false
268
+ })
269
+ await driver.Build()
263
270
  })
264
- await driver.Build()
265
- })
266
271
 
267
- it('should create any function connectors', async function () {
268
- const myCapsFunction = {
269
- [Capabilities.PROJECTNAME]: 'security.allowUnsafe.connectors',
270
- [Capabilities.CONTAINERMODE]: functionConnector,
271
- [Capabilities.SCRIPTING_ENABLE_MEMORY]: true,
272
- [Capabilities.SECURITY_ALLOW_UNSAFE]: false
273
- }
274
- const driver = new BotDriver(myCapsFunction)
275
- await driver.Build()
272
+ it('should create any function connectors', async function () {
273
+ const myCapsFunction = {
274
+ [Capabilities.PROJECTNAME]: 'security.allowUnsafe.connectors',
275
+ [Capabilities.CONTAINERMODE]: functionConnector,
276
+ [Capabilities.SCRIPTING_ENABLE_MEMORY]: true,
277
+ [Capabilities.SECURITY_ALLOW_UNSAFE]: false
278
+ }
279
+ const driver = new BotDriver(myCapsFunction)
280
+ await driver.Build()
281
+ })
276
282
  })
277
- })
278
283
 
279
- describe('media input', function () {
280
- it('should fail for downloadMedia global arg without baseDir', async function () {
281
- const args = {
282
- downloadMedia: true
283
- }
284
+ describe('media input', function () {
285
+ it('should fail for downloadMedia global arg without baseDir', async function () {
286
+ const args = {
287
+ downloadMedia: true
288
+ }
284
289
 
285
- const driver = new BotDriver(_getSimpleRestCaps({
286
- [Capabilities.USER_INPUTS]: [
287
- {
288
- ref: 'MEDIA',
289
- src: 'MediaInput',
290
- args
291
- }
292
- ]
293
- }))
294
- const compiler = driver.BuildCompiler()
295
- const container = await driver.Build()
296
- await container.Start()
297
-
298
- try {
299
- compiler.ReadScript(path.resolve(__dirname, 'convos'), 'media.convo.txt')
300
- await compiler.convos[0].Run(container)
301
- assert.fail('should have failed')
302
- } catch (err) {
303
- assert.isTrue(err.message.indexOf('Security Error. Using base dir global argument in MediaInput is required') >= 0)
304
- }
305
- await container && container.Clean()
306
- })
290
+ const driver = new BotDriver(_getSimpleRestCaps({
291
+ [Capabilities.USER_INPUTS]: [
292
+ {
293
+ ref: 'MEDIA',
294
+ src: 'MediaInput',
295
+ args
296
+ }
297
+ ]
298
+ }))
299
+ const compiler = driver.BuildCompiler()
300
+ const container = await driver.Build()
301
+ await container.Start()
302
+
303
+ try {
304
+ compiler.ReadScript(path.resolve(__dirname, 'convos'), 'media.convo.txt')
305
+ await compiler.convos[0].Run(container)
306
+ assert.fail('should have failed')
307
+ } catch (err) {
308
+ assert.isTrue(err.message.indexOf('Security Error. Using base dir global argument in MediaInput is required') >= 0)
309
+ }
310
+ await container && container.Clean()
311
+ })
307
312
 
308
- it('should fail for downloadMedia global arg as file', async function () {
309
- const args = {
310
- downloadMedia: true
311
- }
313
+ it('should fail for downloadMedia global arg as file', async function () {
314
+ const args = {
315
+ downloadMedia: true
316
+ }
312
317
 
313
- const driver = new BotDriver(_getSimpleRestCaps({
314
- [Capabilities.USER_INPUTS]: [
315
- {
316
- ref: 'MEDIA',
317
- src: 'MediaInput',
318
- args
319
- }
320
- ]
321
- }))
322
- const compiler = driver.BuildCompiler()
323
- const container = await driver.Build()
324
- await container.Start()
325
- compiler.ReadScript(path.resolve(__dirname, 'convos'), 'mediaasfile.convo.txt')
326
-
327
- try {
328
- await compiler.convos[0].Run(container)
329
- assert.fail('should have failed')
330
- } catch (err) {
331
- assert.isTrue(err.message.indexOf('Security Error. Using base dir global argument in MediaInput is required') >= 0)
332
- }
333
- await container && container.Clean()
334
- })
318
+ const driver = new BotDriver(_getSimpleRestCaps({
319
+ [Capabilities.USER_INPUTS]: [
320
+ {
321
+ ref: 'MEDIA',
322
+ src: 'MediaInput',
323
+ args
324
+ }
325
+ ]
326
+ }))
327
+ const compiler = driver.BuildCompiler()
328
+ const container = await driver.Build()
329
+ await container.Start()
330
+ compiler.ReadScript(path.resolve(__dirname, 'convos'), 'mediaasfile.convo.txt')
331
+
332
+ try {
333
+ await compiler.convos[0].Run(container)
334
+ assert.fail('should have failed')
335
+ } catch (err) {
336
+ assert.isTrue(err.message.indexOf('Security Error. Using base dir global argument in MediaInput is required') >= 0)
337
+ }
338
+ await container && container.Clean()
339
+ })
335
340
 
336
- it('should fail for wildcard arg', async function () {
337
- const driver = new BotDriver(_getSimpleRestCaps())
338
- const compiler = driver.BuildCompiler()
339
- const container = await driver.Build()
340
- await container.Start()
341
- compiler.ReadScript(path.resolve(__dirname, 'convos'), 'mediawildcard.convo.txt')
342
-
343
- try {
344
- compiler.ExpandConvos()
345
- assert.fail('should have failed')
346
- } catch (err) {
347
- assert.isTrue(err.message.indexOf('Security Error. Using base dir global argument in MediaInput is required') >= 0)
348
- }
349
- await container && container.Clean()
341
+ it('should fail for wildcard arg', async function () {
342
+ const driver = new BotDriver(_getSimpleRestCaps())
343
+ const compiler = driver.BuildCompiler()
344
+ const container = await driver.Build()
345
+ await container.Start()
346
+ compiler.ReadScript(path.resolve(__dirname, 'convos'), 'mediawildcard.convo.txt')
347
+
348
+ try {
349
+ compiler.ExpandConvos()
350
+ assert.fail('should have failed')
351
+ } catch (err) {
352
+ assert.isTrue(err.message.indexOf('Security Error. Using base dir global argument in MediaInput is required') >= 0)
353
+ }
354
+ await container && container.Clean()
355
+ })
350
356
  })
351
357
  })