botium-core 1.13.2 → 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.
- package/.eslintrc.js +6 -3
- package/dist/botium-cjs.js +214 -61
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +213 -61
- package/dist/botium-es.js.map +1 -1
- package/package.json +3 -1
- package/src/Capabilities.js +2 -1
- package/src/containers/plugins/SimpleRestContainer.js +20 -16
- package/src/grid/inbound/proxy.js +2 -1
- package/src/scripting/Convo.js +16 -10
- package/src/scripting/MatchFunctions.js +10 -0
- package/src/scripting/ScriptingProvider.js +106 -37
- package/src/scripting/logichook/LogicHookConsts.js +1 -1
- package/src/scripting/logichook/asserter/WerAsserter.js +59 -0
- package/src/scripting/logichook/logichooks/UpdateCustomLogicHook.js +3 -2
- package/test/compiler/compilercsv.spec.js +104 -3
- package/test/compiler/compilerjson.spec.js +0 -2
- package/test/compiler/compilerxlsx.spec.js +1 -1
- package/test/compiler/convos/csv/utterances_liveperson2.csv +12 -0
- package/test/connectors/simplerest.spec.js +1012 -969
- package/test/convo/fillAndApplyScriptingMemory.spec.js +804 -785
- package/test/convo/partialconvo.spec.js +345 -339
- package/test/driver/capabilities.spec.js +156 -151
- package/test/logichooks/hookfromsrc.spec.js +79 -73
- package/test/plugins/plugins.spec.js +44 -42
- package/test/scripting/asserters/buttonsAsserter.spec.js +257 -240
- package/test/scripting/asserters/cardsAsserter.spec.js +214 -212
- package/test/scripting/asserters/convos/wer_threshold_nok.yml +7 -0
- package/test/scripting/asserters/convos/wer_threshold_ok.yml +7 -0
- package/test/scripting/asserters/intentConfidenceAsserter.spec.js +34 -35
- package/test/scripting/asserters/jsonpathAsserter.spec.js +307 -308
- package/test/scripting/asserters/mediaAsserter.spec.js +236 -234
- package/test/scripting/asserters/werAsserter.spec.js +51 -0
- package/test/scripting/logichooks/setClearScriptingMemory.spec.js +202 -192
- package/test/scripting/matching/matchingmode.spec.js +306 -258
- package/test/scripting/scriptingProvider.spec.js +666 -633
- package/test/scripting/scriptingmemory/fillScriptingMemoryFromFile.spec.js +299 -281
- package/test/scripting/scriptingmemory/useScriptingMemoryForAssertion.spec.js +94 -80
- package/test/scripting/userinputs/defaultUserInputs.spec.js +233 -127
- package/test/scripting/userinputs/mediaInputConvos.spec.js +409 -403
- package/test/scripting/utteranceexpansion/associateByIndex.spec.js +259 -0
- package/test/scripting/utteranceexpansion/convos/associate_utterances_by_index.json +33 -0
- package/test/scripting/utteranceexpansion/convos/media.convo.txt +19 -0
- package/test/scripting/utteranceexpansion/files/step0voice0.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step0voice1.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step0voice2.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step1voice0.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice0.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice1.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice2.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice4.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice5.wav +0 -0
- package/test/security/allowUnsafe.spec.js +274 -268
- package/test/utils.spec.js +40 -38
package/test/utils.spec.js
CHANGED
|
@@ -1,48 +1,50 @@
|
|
|
1
1
|
const assert = require('chai').assert
|
|
2
2
|
const { escapeJSONString, formatTimeout } = require('../src/helpers/Utils')
|
|
3
3
|
|
|
4
|
-
describe('utils
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
describe('utils', function () {
|
|
5
|
+
describe('escapeJSON', function () {
|
|
6
|
+
it('should not modify JSON string which is not containing double quotes', function () {
|
|
7
|
+
assert.equal(
|
|
8
|
+
escapeJSONString('test 123'),
|
|
9
|
+
'test 123',
|
|
10
|
+
'JSON string should not be modified'
|
|
11
|
+
)
|
|
12
|
+
})
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
it('should escape nested double quotes within JSON string', function () {
|
|
15
|
+
assert.equal(
|
|
16
|
+
escapeJSONString('{"test 123"}'),
|
|
17
|
+
'{\\"test 123\\"}',
|
|
18
|
+
'nested double quotes should be escaped within JSON string'
|
|
19
|
+
)
|
|
20
|
+
})
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
it('should not escape nested single quotes within JSON string', function () {
|
|
23
|
+
assert.equal(
|
|
24
|
+
escapeJSONString('{\'test 123\'}'),
|
|
25
|
+
'{\'test 123\'}',
|
|
26
|
+
'nested single quotes should not be escaped within JSON string'
|
|
27
|
+
)
|
|
28
|
+
})
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
it('should escape nested newline within JSON string', function () {
|
|
31
|
+
assert.equal(
|
|
32
|
+
escapeJSONString('test \n123'),
|
|
33
|
+
'test \\n123',
|
|
34
|
+
'nested newlines should be escaped within JSON string'
|
|
35
|
+
)
|
|
36
|
+
})
|
|
35
37
|
})
|
|
36
|
-
})
|
|
37
38
|
|
|
38
|
-
describe('
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
describe('formatTimeout', function () {
|
|
40
|
+
it('should format seconds', function () {
|
|
41
|
+
assert.equal(formatTimeout(2000), '2s')
|
|
42
|
+
})
|
|
43
|
+
it('should format milliseconds', function () {
|
|
44
|
+
assert.equal(formatTimeout(800), '800ms')
|
|
45
|
+
})
|
|
46
|
+
it('should format seconds and milliseconds', function () {
|
|
47
|
+
assert.equal(formatTimeout(2400), '2s 400ms')
|
|
48
|
+
})
|
|
47
49
|
})
|
|
48
50
|
})
|