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.
- package/.eslintrc.js +6 -3
- package/dist/botium-cjs.js +305 -123
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +323 -142
- package/dist/botium-es.js.map +1 -1
- package/package.json +17 -15
- package/src/Capabilities.js +2 -1
- package/src/containers/plugins/SimpleRestContainer.js +23 -16
- package/src/grid/inbound/proxy.js +2 -1
- package/src/helpers/RetryHelper.js +13 -7
- package/src/scripting/Convo.js +36 -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/LogicHookUtils.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/convo/retryconvo.spec.js +134 -0
- 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
|
@@ -6,297 +6,345 @@ const Capabilities = require('../../../').Capabilities
|
|
|
6
6
|
const echoConnector = ({ queueBotSays }) => {
|
|
7
7
|
return {
|
|
8
8
|
UserSays (msg) {
|
|
9
|
-
const botMsg = {
|
|
9
|
+
const botMsg = {
|
|
10
|
+
sender: 'bot',
|
|
11
|
+
sourceData: msg.sourceData,
|
|
12
|
+
messageText: `You said: ${msg.messageText}`
|
|
13
|
+
}
|
|
10
14
|
queueBotSays(botMsg)
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
describe('matching.matchingmode
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
describe('scripting.matching.matchingmode', function () {
|
|
20
|
+
describe('general', function () {
|
|
21
|
+
beforeEach(async function () {
|
|
22
|
+
const myCaps = {
|
|
23
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
24
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
25
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'include'
|
|
26
|
+
}
|
|
27
|
+
const driver = new BotDriver(myCaps)
|
|
28
|
+
this.compiler = driver.BuildCompiler()
|
|
29
|
+
this.container = await driver.Build()
|
|
30
|
+
})
|
|
31
|
+
afterEach(async function () {
|
|
32
|
+
this.container && await this.container.Clean()
|
|
33
|
+
})
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
it('should match int response with string', async function () {
|
|
36
|
+
assert.isTrue(this.compiler.Match(123, '123'))
|
|
37
|
+
})
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
it('should match JSON response with messageText and a string', async function () {
|
|
40
|
+
assert.isTrue(this.compiler.Match({ messageText: 123 }, '123'))
|
|
41
|
+
})
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
it('should match JSON response with toString', async function () {
|
|
44
|
+
assert.isTrue(this.compiler.Match({ somethingElse: '123' }, '"somethingElse":"123"'))
|
|
45
|
+
})
|
|
40
46
|
})
|
|
41
|
-
})
|
|
42
47
|
|
|
43
|
-
describe('
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
describe('regexp', function () {
|
|
49
|
+
beforeEach(async function () {
|
|
50
|
+
const myCaps = {
|
|
51
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
52
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
53
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'regexp'
|
|
54
|
+
}
|
|
55
|
+
const driver = new BotDriver(myCaps)
|
|
56
|
+
this.compiler = driver.BuildCompiler()
|
|
57
|
+
this.container = await driver.Build()
|
|
58
|
+
})
|
|
59
|
+
afterEach(async function () {
|
|
60
|
+
this.container && await this.container.Clean()
|
|
61
|
+
})
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
it('should check matching with regex', async function () {
|
|
64
|
+
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'regex.convo.txt')
|
|
65
|
+
await this.compiler.convos[0].Run(this.container)
|
|
66
|
+
})
|
|
67
|
+
it('should match case sensitive response', async function () {
|
|
68
|
+
assert.isTrue(this.compiler.Match('This is a long text', 'This .*'))
|
|
69
|
+
})
|
|
70
|
+
it('should not match uppercase response', async function () {
|
|
71
|
+
assert.isFalse(this.compiler.Match('THIS is a long text', 'This .*'))
|
|
72
|
+
})
|
|
61
73
|
})
|
|
62
|
-
it('should match case sensitive response', async function () {
|
|
63
|
-
assert.isTrue(this.compiler.Match('This is a long text', 'This .*'))
|
|
64
|
-
})
|
|
65
|
-
it('should not match uppercase response', async function () {
|
|
66
|
-
assert.isFalse(this.compiler.Match('THIS is a long text', 'This .*'))
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
74
|
|
|
70
|
-
describe('
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
describe('regexpIgnoreCase', function () {
|
|
76
|
+
beforeEach(async function () {
|
|
77
|
+
const myCaps = {
|
|
78
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
79
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
80
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'regexpIgnoreCase'
|
|
81
|
+
}
|
|
82
|
+
const driver = new BotDriver(myCaps)
|
|
83
|
+
this.compiler = driver.BuildCompiler()
|
|
84
|
+
this.container = await driver.Build()
|
|
85
|
+
})
|
|
86
|
+
afterEach(async function () {
|
|
87
|
+
this.container && await this.container.Clean()
|
|
88
|
+
})
|
|
84
89
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
it('should check matching with regex', async function () {
|
|
91
|
+
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'regex.convo.txt')
|
|
92
|
+
await this.compiler.convos[0].Run(this.container)
|
|
93
|
+
})
|
|
94
|
+
it('should match case sensitive response', async function () {
|
|
95
|
+
assert.isTrue(this.compiler.Match('This is a long text', 'This .*'))
|
|
96
|
+
})
|
|
97
|
+
it('should match uppercase response', async function () {
|
|
98
|
+
assert.isTrue(this.compiler.Match('THIS is a long text', 'This .*'))
|
|
99
|
+
})
|
|
100
|
+
it('should not match if pattern is not matching', async function () {
|
|
101
|
+
assert.isFalse(this.compiler.Match('This is a long text', 'notthere .*'))
|
|
102
|
+
})
|
|
94
103
|
})
|
|
95
|
-
it('should not match if pattern is not matching', async function () {
|
|
96
|
-
assert.isFalse(this.compiler.Match('This is a long text', 'notthere .*'))
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
104
|
|
|
100
|
-
describe('
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
describe('include', function () {
|
|
106
|
+
beforeEach(async function () {
|
|
107
|
+
const myCaps = {
|
|
108
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
109
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
110
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'include'
|
|
111
|
+
}
|
|
112
|
+
const driver = new BotDriver(myCaps)
|
|
113
|
+
this.compiler = driver.BuildCompiler()
|
|
114
|
+
this.container = await driver.Build()
|
|
115
|
+
})
|
|
116
|
+
afterEach(async function () {
|
|
117
|
+
this.container && await this.container.Clean()
|
|
118
|
+
})
|
|
114
119
|
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
it('should match case sensitive response', async function () {
|
|
121
|
+
assert.isTrue(this.compiler.Match('This is a long text', 'is a'))
|
|
122
|
+
})
|
|
123
|
+
it('should not match uppercase response', async function () {
|
|
124
|
+
assert.isFalse(this.compiler.Match('This is a long text', 'IS A'))
|
|
125
|
+
})
|
|
126
|
+
it('should not match if pattern is not matching', async function () {
|
|
127
|
+
assert.isFalse(this.compiler.Match('This is a long text', 'notthere'))
|
|
128
|
+
})
|
|
117
129
|
})
|
|
118
|
-
it('should not match uppercase response', async function () {
|
|
119
|
-
assert.isFalse(this.compiler.Match('This is a long text', 'IS A'))
|
|
120
|
-
})
|
|
121
|
-
it('should not match if pattern is not matching', async function () {
|
|
122
|
-
assert.isFalse(this.compiler.Match('This is a long text', 'notthere'))
|
|
123
|
-
})
|
|
124
|
-
})
|
|
125
130
|
|
|
126
|
-
describe('
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
describe('wildcard', function () {
|
|
132
|
+
beforeEach(async function () {
|
|
133
|
+
const myCaps = {
|
|
134
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
135
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
136
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'wildcard'
|
|
137
|
+
}
|
|
138
|
+
const driver = new BotDriver(myCaps)
|
|
139
|
+
this.compiler = driver.BuildCompiler()
|
|
140
|
+
this.container = await driver.Build()
|
|
141
|
+
})
|
|
142
|
+
afterEach(async function () {
|
|
143
|
+
this.container && await this.container.Clean()
|
|
144
|
+
})
|
|
140
145
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
146
|
+
it('should match response with substring', async function () {
|
|
147
|
+
assert.isTrue(this.compiler.Match('Interesting...', 'Interesting'))
|
|
148
|
+
})
|
|
149
|
+
it('should match long response with wildcard', async function () {
|
|
150
|
+
assert.isTrue(this.compiler.Match('this is a long text', 'this is a * text'))
|
|
151
|
+
})
|
|
152
|
+
it('should match very long response with wildcard', async function () {
|
|
153
|
+
assert.isTrue(this.compiler.Match('this is a long text this is a long text this is a long text this is a long text', 'this is a * text this is a * text this is a * text'))
|
|
154
|
+
})
|
|
155
|
+
it('should not match long uppcercase response with wildcard', async function () {
|
|
156
|
+
assert.isFalse(this.compiler.Match('THIS IS A LONG TEXT', 'this is a * text'))
|
|
157
|
+
})
|
|
158
|
+
it('should match very long response with very long wildcard', async function () {
|
|
159
|
+
assert.isTrue(this.compiler.Match('begin this is a long text this is a long text this is a long text this is a long text end', 'begin * end'))
|
|
160
|
+
})
|
|
161
|
+
it('should not allow more than 10 wildcards in a string', async function () {
|
|
162
|
+
try {
|
|
163
|
+
this.compiler.Match('some text', 'begin * * * * * * * * * * * end')
|
|
164
|
+
assert.fail('should have failed')
|
|
165
|
+
} catch (err) {
|
|
166
|
+
assert.equal(err.message, 'Maximum number of 10 wildcards supported.')
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
it('should not match if pattern is not matching', async function () {
|
|
170
|
+
assert.isFalse(this.compiler.Match('This is a long text', '*notthere*'))
|
|
171
|
+
})
|
|
163
172
|
})
|
|
164
|
-
it('should not match if pattern is not matching', async function () {
|
|
165
|
-
assert.isFalse(this.compiler.Match('This is a long text', '*notthere*'))
|
|
166
|
-
})
|
|
167
|
-
})
|
|
168
173
|
|
|
169
|
-
describe('
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
describe('wildcardIgnoreCase', function () {
|
|
175
|
+
beforeEach(async function () {
|
|
176
|
+
const myCaps = {
|
|
177
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
178
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
179
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'wildcardIgnoreCase'
|
|
180
|
+
}
|
|
181
|
+
const driver = new BotDriver(myCaps)
|
|
182
|
+
this.compiler = driver.BuildCompiler()
|
|
183
|
+
this.container = await driver.Build()
|
|
184
|
+
})
|
|
185
|
+
afterEach(async function () {
|
|
186
|
+
this.container && await this.container.Clean()
|
|
187
|
+
})
|
|
183
188
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
189
|
+
it('should match response with substring', async function () {
|
|
190
|
+
assert.isTrue(this.compiler.Match('You said: So.....', 'so...'))
|
|
191
|
+
})
|
|
192
|
+
it('should match long response with wildcard', async function () {
|
|
193
|
+
assert.isTrue(this.compiler.Match('this is a long text', 'this is a * text'))
|
|
194
|
+
})
|
|
195
|
+
it('should match long uppcercase response with wildcard', async function () {
|
|
196
|
+
assert.isTrue(this.compiler.Match('THIS IS A LONG TEXT', 'this is a * text'))
|
|
197
|
+
})
|
|
198
|
+
it('should not match if pattern is not matching', async function () {
|
|
199
|
+
assert.isFalse(this.compiler.Match('This is a long text', '*notthere*'))
|
|
200
|
+
})
|
|
201
|
+
it('should match response with utterances list', async function () {
|
|
202
|
+
this.compiler.scriptingEvents.assertBotResponse('So.....', [
|
|
203
|
+
'lol',
|
|
204
|
+
'okay',
|
|
205
|
+
'so...',
|
|
206
|
+
'go on',
|
|
207
|
+
'umm',
|
|
208
|
+
'interesting',
|
|
209
|
+
'really?'
|
|
210
|
+
], 'test')
|
|
211
|
+
})
|
|
206
212
|
})
|
|
207
|
-
})
|
|
208
213
|
|
|
209
|
-
describe('
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
describe('wildcardExact', function () {
|
|
215
|
+
beforeEach(async function () {
|
|
216
|
+
const myCaps = {
|
|
217
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
218
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
219
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'wildcardExact'
|
|
220
|
+
}
|
|
221
|
+
const driver = new BotDriver(myCaps)
|
|
222
|
+
this.compiler = driver.BuildCompiler()
|
|
223
|
+
this.container = await driver.Build()
|
|
224
|
+
})
|
|
225
|
+
afterEach(async function () {
|
|
226
|
+
this.container && await this.container.Clean()
|
|
227
|
+
})
|
|
223
228
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
229
|
+
it('should not match response with substring', async function () {
|
|
230
|
+
assert.isFalse(this.compiler.Match('Interesting...', 'Interesting'))
|
|
231
|
+
})
|
|
232
|
+
it('should match long response with wildcard', async function () {
|
|
233
|
+
assert.isTrue(this.compiler.Match('this is a long text', 'this is a * text'))
|
|
234
|
+
})
|
|
235
|
+
it('should match very long response with wildcard', async function () {
|
|
236
|
+
assert.isTrue(this.compiler.Match('this is a long text this is a long text this is a long text this is a long text', 'this is a * text this is a * text this is a * text this is a * text'))
|
|
237
|
+
})
|
|
238
|
+
it('should not match long uppcercase response with wildcard', async function () {
|
|
239
|
+
assert.isFalse(this.compiler.Match('THIS IS A LONG TEXT', 'this is a * text'))
|
|
240
|
+
})
|
|
241
|
+
it('should match very long response with very long wildcard', async function () {
|
|
242
|
+
assert.isTrue(this.compiler.Match('begin this is a long text this is a long text this is a long text this is a long text end', 'begin * end'))
|
|
243
|
+
})
|
|
244
|
+
it('should not allow more than 10 wildcards in a string', async function () {
|
|
245
|
+
try {
|
|
246
|
+
this.compiler.Match('some text', 'begin * * * * * * * * * * * end')
|
|
247
|
+
assert.fail('should have failed')
|
|
248
|
+
} catch (err) {
|
|
249
|
+
assert.equal(err.message, 'Maximum number of 10 wildcards supported.')
|
|
250
|
+
}
|
|
251
|
+
})
|
|
252
|
+
it('should not match if pattern is not matching', async function () {
|
|
253
|
+
assert.isFalse(this.compiler.Match('This is a long text', '*notthere*'))
|
|
254
|
+
})
|
|
238
255
|
})
|
|
239
|
-
it('should not allow more than 10 wildcards in a string', async function () {
|
|
240
|
-
try {
|
|
241
|
-
this.compiler.Match('some text', 'begin * * * * * * * * * * * end')
|
|
242
|
-
assert.fail('should have failed')
|
|
243
|
-
} catch (err) {
|
|
244
|
-
assert.equal(err.message, 'Maximum number of 10 wildcards supported.')
|
|
245
|
-
}
|
|
246
|
-
})
|
|
247
|
-
it('should not match if pattern is not matching', async function () {
|
|
248
|
-
assert.isFalse(this.compiler.Match('This is a long text', '*notthere*'))
|
|
249
|
-
})
|
|
250
|
-
})
|
|
251
256
|
|
|
252
|
-
describe('
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
257
|
+
describe('equals', function () {
|
|
258
|
+
beforeEach(async function () {
|
|
259
|
+
const myCaps = {
|
|
260
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
261
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
262
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'equals'
|
|
263
|
+
}
|
|
264
|
+
const driver = new BotDriver(myCaps)
|
|
265
|
+
this.compiler = driver.BuildCompiler()
|
|
266
|
+
this.container = await driver.Build()
|
|
267
|
+
})
|
|
268
|
+
afterEach(async function () {
|
|
269
|
+
this.container && await this.container.Clean()
|
|
270
|
+
})
|
|
266
271
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
it('should match case sensitive response', async function () {
|
|
273
|
+
assert.isTrue(this.compiler.Match('This is a long text', 'This is a long text'))
|
|
274
|
+
})
|
|
275
|
+
it('should not match uppercase response', async function () {
|
|
276
|
+
assert.isFalse(this.compiler.Match('This is a long text', 'THIS is a long text'))
|
|
277
|
+
})
|
|
278
|
+
it('should not match for partial match', async function () {
|
|
279
|
+
assert.isFalse(this.compiler.Match('This is a long text', 'long'))
|
|
280
|
+
})
|
|
275
281
|
})
|
|
276
|
-
})
|
|
277
282
|
|
|
278
|
-
describe('
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
283
|
+
describe('equalsIgnorcase', function () {
|
|
284
|
+
beforeEach(async function () {
|
|
285
|
+
const myCaps = {
|
|
286
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
287
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
288
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'equalsIgnoreCase'
|
|
289
|
+
}
|
|
290
|
+
const driver = new BotDriver(myCaps)
|
|
291
|
+
this.compiler = driver.BuildCompiler()
|
|
292
|
+
this.container = await driver.Build()
|
|
293
|
+
})
|
|
294
|
+
afterEach(async function () {
|
|
295
|
+
this.container && await this.container.Clean()
|
|
296
|
+
})
|
|
292
297
|
|
|
293
|
-
|
|
294
|
-
|
|
298
|
+
it('should match case sensitive response', async function () {
|
|
299
|
+
assert.isTrue(this.compiler.Match('This is a long text', 'This is a long text'))
|
|
300
|
+
})
|
|
301
|
+
it('should match uppercase response', async function () {
|
|
302
|
+
assert.isTrue(this.compiler.Match('This is a long text', 'THIS is a long text'))
|
|
303
|
+
})
|
|
304
|
+
it('should not match for partial match', async function () {
|
|
305
|
+
assert.isFalse(this.compiler.Match('This is a long text', 'long'))
|
|
306
|
+
})
|
|
295
307
|
})
|
|
296
|
-
|
|
297
|
-
|
|
308
|
+
|
|
309
|
+
describe('wer.lowthreshold', function () {
|
|
310
|
+
beforeEach(async function () {
|
|
311
|
+
const myCaps = {
|
|
312
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
313
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
314
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'wer',
|
|
315
|
+
[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]: [0.1]
|
|
316
|
+
}
|
|
317
|
+
const driver = new BotDriver(myCaps)
|
|
318
|
+
this.compiler = driver.BuildCompiler()
|
|
319
|
+
this.container = await driver.Build()
|
|
320
|
+
})
|
|
321
|
+
afterEach(async function () {
|
|
322
|
+
this.container && await this.container.Clean()
|
|
323
|
+
})
|
|
324
|
+
|
|
325
|
+
it('should not match because of low threshold', async function () {
|
|
326
|
+
assert.isFalse(this.compiler.Match('test 123', 'tast 123'))
|
|
327
|
+
})
|
|
298
328
|
})
|
|
299
|
-
|
|
300
|
-
|
|
329
|
+
|
|
330
|
+
describe('wer.highthreshold', function () {
|
|
331
|
+
beforeEach(async function () {
|
|
332
|
+
const myCaps = {
|
|
333
|
+
[Capabilities.PROJECTNAME]: 'matching.matchingmode',
|
|
334
|
+
[Capabilities.CONTAINERMODE]: echoConnector,
|
|
335
|
+
[Capabilities.SCRIPTING_MATCHING_MODE]: 'wer',
|
|
336
|
+
[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]: [0.6]
|
|
337
|
+
}
|
|
338
|
+
const driver = new BotDriver(myCaps)
|
|
339
|
+
this.compiler = driver.BuildCompiler()
|
|
340
|
+
this.container = await driver.Build()
|
|
341
|
+
})
|
|
342
|
+
afterEach(async function () {
|
|
343
|
+
this.container && await this.container.Clean()
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
it('should match because of high threshold', async function () {
|
|
347
|
+
assert.isTrue(this.compiler.Match('test 123', 'tast 123'))
|
|
348
|
+
})
|
|
301
349
|
})
|
|
302
350
|
})
|