botium-core 1.13.11 → 1.13.14
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/dist/botium-cjs.js +109 -58
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +95 -45
- package/dist/botium-es.js.map +1 -1
- package/index.js +15 -9
- package/package.json +1 -1
- package/src/Capabilities.js +4 -0
- package/src/Defaults.js +0 -1
- package/src/containers/plugins/SimpleRestContainer.js +50 -22
- package/src/helpers/TranscriptUtils.js +12 -0
- package/test/compiler/compilermarkdown.spec.js +11 -11
- package/test/compiler/compilertxt.spec.js +11 -11
- package/test/compiler/compilerxlsx.spec.js +10 -10
- package/test/compiler/convos/md/{convos_with!.md → convos_with_exclamation.md} +0 -0
- package/test/compiler/convos/md/{convos_with!_secline.md → convos_with_exclamation_secline.md} +0 -0
- package/test/compiler/convos/md/{convos_with!!!!.md → convos_with_four_exclamation.md} +0 -0
- package/test/compiler/convos/md/{convos_with????.md → convos_with_four_question.md} +0 -0
- package/test/compiler/convos/md/{convos_with?.md → convos_with_question.md} +0 -0
- package/test/compiler/convos/md/{convos_with?!.md → convos_with_question_exclamation.md} +0 -0
- package/test/compiler/convos/md/{convos_with?_invalid.md → convos_with_question_invalid.md} +0 -0
- package/test/compiler/convos/md/{convos_with?_secline.md → convos_with_question_secline.md} +0 -0
- package/test/compiler/convos/md/{convos_with!!.md → convos_with_two_exclamation.md} +0 -0
- package/test/compiler/convos/md/{convos_with??.md → convos_with_two_question.md} +0 -0
- package/test/compiler/convos/md/{convos_with??!.md → convos_with_two_question_exclamation.md} +0 -0
- package/test/compiler/convos/txt/{convos_with!.convo.txt → convos_with_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with!_secline.convo.txt → convos_with_exclamation_secline.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with!!!!.convo.txt → convos_with_four_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with????.convo.txt → convos_with_four_question.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with_#.convo.txt → convos_with_hashmark.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with?.convo.txt → convos_with_question.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with?!.convo.txt → convos_with_question_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with?_secline.convo.txt → convos_with_question_secline.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with!!.convo.txt → convos_with_two_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with??.convo.txt → convos_with_two_question.convo.txt} +0 -0
- package/test/compiler/convos/txt/{convos_with??!.convo.txt → convos_with_two_question_exclamation.convo.txt} +0 -0
- package/test/compiler/convos/xlsx/{convos_with!.xlsx → convos_with_exclamation.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with!_secline.xlsx → convos_with_exclamation_secline.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with!!!!.xlsx → convos_with_four_exclamation.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with????.xlsx → convos_with_four_question.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with?.xlsx → convos_with_question.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with?!.xlsx → convos_with_question_exclamation.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with?_secline.xlsx → convos_with_question_secline.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with!!.xlsx → convos_with_two_exclamation.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with??.xlsx → convos_with_two_question.xlsx} +0 -0
- package/test/compiler/convos/xlsx/{convos_with??!.xlsx → convos_with_two_question_exclamation.xlsx} +0 -0
- package/test/connectors/simplerest.spec.js +53 -4
- package/test/driver/capabilities.spec.js +7 -7
- package/test/helpers/convos/hello.convo.txt +6 -0
- package/test/helpers/transcriptutils.spec.js +71 -0
package/index.js
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
BotDriver: require('./src/BotDriver'),
|
|
3
|
-
ScriptingProvider: require('./src/scripting/ScriptingProvider'),
|
|
4
|
-
ScriptingConstants: require('./src/scripting/Constants'),
|
|
5
3
|
Capabilities: require('./src/Capabilities'),
|
|
6
4
|
Defaults: require('./src/Defaults'),
|
|
7
5
|
Enums: require('./src/Enums'),
|
|
8
|
-
Source: require('./src/Source'),
|
|
9
6
|
Events: require('./src/Events'),
|
|
10
7
|
Plugins: require('./src/Plugins'),
|
|
8
|
+
Source: require('./src/Source'),
|
|
9
|
+
|
|
10
|
+
InboundProxy: require('./src/grid/inbound/proxy'),
|
|
11
|
+
|
|
12
|
+
HookUtils: require('./src/helpers/HookUtils'),
|
|
13
|
+
TranscriptUtils: require('./src/helpers/TranscriptUtils'),
|
|
14
|
+
|
|
15
|
+
BotiumMockRichMessageTypes: require('./src/mocks/BotiumMockRichMessageTypes'),
|
|
16
|
+
|
|
11
17
|
BotiumError: require('./src/scripting/BotiumError').BotiumError,
|
|
18
|
+
ScriptingConstants: require('./src/scripting/Constants'),
|
|
12
19
|
ScriptingMemory: require('./src/scripting/ScriptingMemory'),
|
|
13
|
-
|
|
20
|
+
ScriptingProvider: require('./src/scripting/ScriptingProvider'),
|
|
14
21
|
LogicHookConstants: require('./src/scripting/logichook/LogicHookConsts'),
|
|
22
|
+
|
|
15
23
|
Lib: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
InboundProxy: require('./src/grid/inbound/proxy'),
|
|
20
|
-
BotiumMockRichMessageTypes: require('./src/mocks/BotiumMockRichMessageTypes')
|
|
24
|
+
SimpleRestContainer: require('./src/containers/plugins/SimpleRestContainer'),
|
|
25
|
+
tryLoadPlugin: require('./src/containers/plugins/index').tryLoadPlugin
|
|
26
|
+
}
|
|
21
27
|
}
|
package/package.json
CHANGED
package/src/Capabilities.js
CHANGED
|
@@ -73,10 +73,14 @@ module.exports = {
|
|
|
73
73
|
SIMPLEREST_RESPONSE_HOOK: 'SIMPLEREST_RESPONSE_HOOK',
|
|
74
74
|
SIMPLEREST_MEDIA_JSONPATH: 'SIMPLEREST_MEDIA_JSONPATH',
|
|
75
75
|
SIMPLEREST_BUTTONS_JSONPATH: 'SIMPLEREST_BUTTONS_JSONPATH',
|
|
76
|
+
SIMPLEREST_BUTTONS_TEXT_SUBJSONPATH: 'SIMPLEREST_BUTTONS_TEXT_SUBJSONPATH',
|
|
77
|
+
SIMPLEREST_BUTTONS_PAYLOAD_SUBJSONPATH: 'SIMPLEREST_BUTTONS_PAYLOAD_SUBJSONPATH',
|
|
76
78
|
SIMPLEREST_CARDS_JSONPATH: 'SIMPLEREST_CARDS_JSONPATH',
|
|
77
79
|
SIMPLEREST_CARD_TEXT_JSONPATH: 'SIMPLEREST_CARD_TEXT_JSONPATH',
|
|
78
80
|
SIMPLEREST_CARD_SUBTEXT_JSONPATH: 'SIMPLEREST_CARD_SUBTEXT_JSONPATH',
|
|
79
81
|
SIMPLEREST_CARD_BUTTONS_JSONPATH: 'SIMPLEREST_CARD_BUTTONS_JSONPATH',
|
|
82
|
+
SIMPLEREST_CARD_BUTTONS_TEXT_SUBJSONPATH: 'SIMPLEREST_CARD_BUTTONS_TEXT_SUBJSONPATH',
|
|
83
|
+
SIMPLEREST_CARD_BUTTONS_PAYLOAD_SUBJSONPATH: 'SIMPLEREST_CARD_BUTTONS_PAYLOAD_SUBJSONPATH',
|
|
80
84
|
SIMPLEREST_CARD_ATTACHMENTS_JSONPATH: 'SIMPLEREST_CARD_ATTACHMENTS_JSONPATH',
|
|
81
85
|
SIMPLEREST_CONTEXT_JSONPATH: 'SIMPLEREST_CONTEXT_JSONPATH',
|
|
82
86
|
SIMPLEREST_CONTEXT_MERGE_OR_REPLACE: 'SIMPLEREST_CONTEXT_MERGE_OR_REPLACE',
|
package/src/Defaults.js
CHANGED
|
@@ -9,7 +9,6 @@ module.exports = {
|
|
|
9
9
|
[Capabilities.TEMPDIR]: 'botiumwork',
|
|
10
10
|
[Capabilities.CLEANUPTEMPDIR]: true,
|
|
11
11
|
[Capabilities.WAITFORBOTTIMEOUT]: 10000,
|
|
12
|
-
[Capabilities.SIMULATE_WRITING_SPEED]: false,
|
|
13
12
|
[Capabilities.SIMPLEREST_PING_RETRIES]: 6,
|
|
14
13
|
[Capabilities.SIMPLEREST_PING_TIMEOUT]: 10000,
|
|
15
14
|
[Capabilities.SIMPLEREST_PING_VERB]: 'GET',
|
|
@@ -228,6 +228,7 @@ module.exports = class SimpleRestContainer {
|
|
|
228
228
|
await this._unsubscribeInbound()
|
|
229
229
|
await this._stopPolling()
|
|
230
230
|
this.view = {}
|
|
231
|
+
this.cookies = {}
|
|
231
232
|
}
|
|
232
233
|
|
|
233
234
|
Clean () {
|
|
@@ -294,18 +295,24 @@ module.exports = class SimpleRestContainer {
|
|
|
294
295
|
|
|
295
296
|
const result = []
|
|
296
297
|
if (isFromUser) {
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
for (const jsonPathBody of jsonPathsBody) {
|
|
302
|
-
const rb = jp.query(body, jsonPathBody)
|
|
298
|
+
const _extractFrom = (root, jsonPaths) => {
|
|
299
|
+
const flattened = []
|
|
300
|
+
for (const jsonPath of jsonPaths) {
|
|
301
|
+
const rb = jp.query(root, jsonPath)
|
|
303
302
|
if (_.isArray(rb)) {
|
|
304
|
-
rb.forEach(r =>
|
|
303
|
+
_.flattenDeep(rb).forEach(r => flattened.push(r))
|
|
305
304
|
} else if (rb) {
|
|
306
|
-
|
|
305
|
+
flattened.push(rb)
|
|
307
306
|
}
|
|
308
307
|
}
|
|
308
|
+
return flattened
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const jsonPathRoots = []
|
|
312
|
+
|
|
313
|
+
const jsonPathsBody = getAllCapValues(Capabilities.SIMPLEREST_BODY_JSONPATH, this.caps)
|
|
314
|
+
if (jsonPathsBody.length > 0) {
|
|
315
|
+
jsonPathRoots.push(..._extractFrom(body, jsonPathsBody))
|
|
309
316
|
} else {
|
|
310
317
|
jsonPathRoots.push(body)
|
|
311
318
|
}
|
|
@@ -327,18 +334,35 @@ module.exports = class SimpleRestContainer {
|
|
|
327
334
|
return retrievedMedia
|
|
328
335
|
}
|
|
329
336
|
|
|
330
|
-
const _retrieveButtons = (jsonPathButtonRoot,
|
|
337
|
+
const _retrieveButtons = (jsonPathButtonRoot, capPrefix) => {
|
|
338
|
+
const jsonPathsButtons = getAllCapValues(`${capPrefix}_JSONPATH`, this.caps)
|
|
339
|
+
const jsonPathsButtonsText = getAllCapValues(`${capPrefix}_TEXT_SUBJSONPATH`, this.caps)
|
|
340
|
+
const jsonPathsButtonsPayload = getAllCapValues(`${capPrefix}_PAYLOAD_SUBJSONPATH`, this.caps)
|
|
341
|
+
|
|
331
342
|
const retrievedButtons = []
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
)
|
|
343
|
+
|
|
344
|
+
const responseButtons = _extractFrom(jsonPathButtonRoot, jsonPathsButtons)
|
|
345
|
+
for (const responseButton of responseButtons) {
|
|
346
|
+
const retrievedButton = {}
|
|
347
|
+
if (_.isString(responseButton)) {
|
|
348
|
+
retrievedButton.text = responseButton
|
|
349
|
+
} else {
|
|
350
|
+
if (jsonPathsButtonsText.length > 0) {
|
|
351
|
+
const possibleTexts = _extractFrom(responseButton, jsonPathsButtonsText)
|
|
352
|
+
if (possibleTexts.length > 0) retrievedButton.text = possibleTexts[0]
|
|
353
|
+
}
|
|
354
|
+
if (jsonPathsButtonsPayload.length > 0) {
|
|
355
|
+
const possiblePayloads = _extractFrom(responseButton, jsonPathsButtonsPayload)
|
|
356
|
+
if (possiblePayloads.length > 0) retrievedButton.payload = possiblePayloads[0]
|
|
357
|
+
}
|
|
340
358
|
}
|
|
341
|
-
|
|
359
|
+
if (Object.keys(retrievedButton).length === 0 && responseButton) {
|
|
360
|
+
retrievedButton.text = JSON.stringify(responseButton)
|
|
361
|
+
}
|
|
362
|
+
if (Object.keys(retrievedButton).length > 0) {
|
|
363
|
+
retrievedButtons.push(retrievedButton)
|
|
364
|
+
}
|
|
365
|
+
}
|
|
342
366
|
return retrievedButtons
|
|
343
367
|
}
|
|
344
368
|
|
|
@@ -356,7 +380,7 @@ module.exports = class SimpleRestContainer {
|
|
|
356
380
|
|
|
357
381
|
const media = _retrieveMedia(jsonPathRoot, getAllCapValues(Capabilities.SIMPLEREST_MEDIA_JSONPATH, this.caps))
|
|
358
382
|
debug(`found response media: ${util.inspect(media)}`)
|
|
359
|
-
const buttons = _retrieveButtons(jsonPathRoot,
|
|
383
|
+
const buttons = _retrieveButtons(jsonPathRoot, 'SIMPLEREST_BUTTONS')
|
|
360
384
|
debug(`found response buttons: ${util.inspect(buttons)}`)
|
|
361
385
|
const cards = []
|
|
362
386
|
|
|
@@ -377,7 +401,7 @@ module.exports = class SimpleRestContainer {
|
|
|
377
401
|
card.subtext = _getCardText(jp.query(c, jsonPath))
|
|
378
402
|
})
|
|
379
403
|
|
|
380
|
-
card.buttons = _retrieveButtons(c,
|
|
404
|
+
card.buttons = _retrieveButtons(c, 'SIMPLEREST_CARD_BUTTONS')
|
|
381
405
|
card.media = _retrieveMedia(c, getAllCapValues(Capabilities.SIMPLEREST_CARD_ATTACHMENTS_JSONPATH, this.caps))
|
|
382
406
|
|
|
383
407
|
if (_.keys(card).length > 0) {
|
|
@@ -589,13 +613,17 @@ module.exports = class SimpleRestContainer {
|
|
|
589
613
|
}))
|
|
590
614
|
if (err) {
|
|
591
615
|
debug(`_waitForUrlResponse error on url check ${pingConfig.uri}: ${err}`)
|
|
592
|
-
|
|
616
|
+
if (tries <= retries) {
|
|
617
|
+
await timeout(pingConfig.timeout)
|
|
618
|
+
}
|
|
593
619
|
} else if (response.statusCode >= 400) {
|
|
594
620
|
debug(`_waitForUrlResponse on url check ${pingConfig.uri} got error response: ${response.statusCode}/${response.statusMessage}`)
|
|
595
621
|
if (debug.enabled && body) {
|
|
596
622
|
debug(botiumUtils.shortenJsonString(body))
|
|
597
623
|
}
|
|
598
|
-
|
|
624
|
+
if (tries <= retries) {
|
|
625
|
+
await timeout(pingConfig.timeout)
|
|
626
|
+
}
|
|
599
627
|
} else {
|
|
600
628
|
debug(`_waitForUrlResponse success on url check ${pingConfig.uri}: ${response.statusCode}/${response.statusMessage}`)
|
|
601
629
|
this._storeCookiesFromResponse(response)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const _ = require('lodash')
|
|
2
|
+
|
|
3
|
+
module.exports.hasWaitForBotTimeout = (transciptError) => {
|
|
4
|
+
if (!transciptError) {
|
|
5
|
+
return false
|
|
6
|
+
}
|
|
7
|
+
const str = transciptError.message || (_.isString(transciptError) ? transciptError : null)
|
|
8
|
+
if (!str) {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
return str.indexOf(': error waiting for bot - Bot did not respond within') > 0
|
|
12
|
+
}
|
|
@@ -118,7 +118,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
118
118
|
})
|
|
119
119
|
describe('negating', function () {
|
|
120
120
|
it('should read ! as not', async function () {
|
|
121
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
121
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation.md'))
|
|
122
122
|
const context = buildContext()
|
|
123
123
|
|
|
124
124
|
const caps = {
|
|
@@ -131,7 +131,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
131
131
|
assert.equal(context.convos[0].conversation[1].asserters[0].not, true)
|
|
132
132
|
})
|
|
133
133
|
it('should read !! as !', async function () {
|
|
134
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
134
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_exclamation.md'))
|
|
135
135
|
const context = buildContext()
|
|
136
136
|
const caps = {
|
|
137
137
|
}
|
|
@@ -142,7 +142,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
142
142
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
143
143
|
})
|
|
144
144
|
it('should read n*! as (n-1)*!', async function () {
|
|
145
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
145
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_exclamation.md'))
|
|
146
146
|
const context = buildContext()
|
|
147
147
|
|
|
148
148
|
const caps = {
|
|
@@ -154,7 +154,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
154
154
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
155
155
|
})
|
|
156
156
|
it('should read ! as ! in second line', async function () {
|
|
157
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
157
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation_secline.md'))
|
|
158
158
|
const context = buildContext()
|
|
159
159
|
const caps = {
|
|
160
160
|
}
|
|
@@ -167,7 +167,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
167
167
|
})
|
|
168
168
|
describe('optional', function () {
|
|
169
169
|
it('should read ? as optional', async function () {
|
|
170
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
170
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question.md'))
|
|
171
171
|
const context = buildContext()
|
|
172
172
|
|
|
173
173
|
const caps = {
|
|
@@ -180,7 +180,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
180
180
|
assert.equal(context.convos[0].conversation[1].asserters[0].optional, true)
|
|
181
181
|
})
|
|
182
182
|
it('should fail if not all item optional in the same block', async function () {
|
|
183
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
183
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_invalid.md'))
|
|
184
184
|
const context = buildContext()
|
|
185
185
|
|
|
186
186
|
const caps = {
|
|
@@ -195,7 +195,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
195
195
|
}
|
|
196
196
|
})
|
|
197
197
|
it('should read ?? as ?', async function () {
|
|
198
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
198
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question.md'))
|
|
199
199
|
const context = buildContext()
|
|
200
200
|
const caps = {
|
|
201
201
|
}
|
|
@@ -206,7 +206,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
206
206
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
207
207
|
})
|
|
208
208
|
it('should read n*? as (n-1)*?', async function () {
|
|
209
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
209
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_question.md'))
|
|
210
210
|
const context = buildContext()
|
|
211
211
|
|
|
212
212
|
const caps = {
|
|
@@ -218,7 +218,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
218
218
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
219
219
|
})
|
|
220
220
|
it('should read ? as ? in second line', async function () {
|
|
221
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
221
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_secline.md'))
|
|
222
222
|
const context = buildContext()
|
|
223
223
|
const caps = {
|
|
224
224
|
}
|
|
@@ -231,7 +231,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
231
231
|
})
|
|
232
232
|
describe('optional and negate', function () {
|
|
233
233
|
it('should read ?! as optional and not', async function () {
|
|
234
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
234
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_exclamation.md'))
|
|
235
235
|
const context = buildContext()
|
|
236
236
|
|
|
237
237
|
const caps = {}
|
|
@@ -243,7 +243,7 @@ describe('compiler.compilermarkdown', function () {
|
|
|
243
243
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
244
244
|
})
|
|
245
245
|
it('should read ??! as ?!', async function () {
|
|
246
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
246
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question_exclamation.md'))
|
|
247
247
|
const context = buildContext()
|
|
248
248
|
const caps = {}
|
|
249
249
|
const compiler = new Compiler(context, Object.assign({}, DefaultCapabilities, caps))
|
|
@@ -42,7 +42,7 @@ describe('compiler.compilertxt', function () {
|
|
|
42
42
|
assert.equal(context.convos[0].conversation.length, 0)
|
|
43
43
|
})
|
|
44
44
|
it('should read ! as not', async function () {
|
|
45
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
45
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation.convo.txt'))
|
|
46
46
|
const context = buildContext()
|
|
47
47
|
|
|
48
48
|
const caps = {
|
|
@@ -54,7 +54,7 @@ describe('compiler.compilertxt', function () {
|
|
|
54
54
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
55
55
|
})
|
|
56
56
|
it('should read !! as !', async function () {
|
|
57
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
57
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_exclamation.convo.txt'))
|
|
58
58
|
const context = buildContext()
|
|
59
59
|
const caps = {
|
|
60
60
|
}
|
|
@@ -65,7 +65,7 @@ describe('compiler.compilertxt', function () {
|
|
|
65
65
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
66
66
|
})
|
|
67
67
|
it('should read n*! as (n-1)*!', async function () {
|
|
68
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
68
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_exclamation.convo.txt'))
|
|
69
69
|
const context = buildContext()
|
|
70
70
|
|
|
71
71
|
const caps = {
|
|
@@ -77,7 +77,7 @@ describe('compiler.compilertxt', function () {
|
|
|
77
77
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
78
78
|
})
|
|
79
79
|
it('should read ! as ! in second line', async function () {
|
|
80
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
80
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation_secline.convo.txt'))
|
|
81
81
|
const context = buildContext()
|
|
82
82
|
const caps = {
|
|
83
83
|
}
|
|
@@ -88,7 +88,7 @@ describe('compiler.compilertxt', function () {
|
|
|
88
88
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
89
89
|
})
|
|
90
90
|
it('should read ? as optional', async function () {
|
|
91
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
91
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question.convo.txt'))
|
|
92
92
|
const context = buildContext()
|
|
93
93
|
|
|
94
94
|
const caps = {
|
|
@@ -100,7 +100,7 @@ describe('compiler.compilertxt', function () {
|
|
|
100
100
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
101
101
|
})
|
|
102
102
|
it('should read ?? as ?', async function () {
|
|
103
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
103
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question.convo.txt'))
|
|
104
104
|
const context = buildContext()
|
|
105
105
|
const caps = {
|
|
106
106
|
}
|
|
@@ -111,7 +111,7 @@ describe('compiler.compilertxt', function () {
|
|
|
111
111
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
112
112
|
})
|
|
113
113
|
it('should read ?! as optional and not', async function () {
|
|
114
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
114
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_exclamation.convo.txt'))
|
|
115
115
|
const context = buildContext()
|
|
116
116
|
|
|
117
117
|
const caps = {
|
|
@@ -124,7 +124,7 @@ describe('compiler.compilertxt', function () {
|
|
|
124
124
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
125
125
|
})
|
|
126
126
|
it('should read ??! as ?!', async function () {
|
|
127
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
127
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question_exclamation.convo.txt'))
|
|
128
128
|
const context = buildContext()
|
|
129
129
|
|
|
130
130
|
const caps = {
|
|
@@ -137,7 +137,7 @@ describe('compiler.compilertxt', function () {
|
|
|
137
137
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
138
138
|
})
|
|
139
139
|
it('should read n*? as (n-1)*?', async function () {
|
|
140
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
140
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_question.convo.txt'))
|
|
141
141
|
const context = buildContext()
|
|
142
142
|
|
|
143
143
|
const caps = {
|
|
@@ -149,7 +149,7 @@ describe('compiler.compilertxt', function () {
|
|
|
149
149
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
150
150
|
})
|
|
151
151
|
it('should read ? as ? in second line', async function () {
|
|
152
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
152
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_secline.convo.txt'))
|
|
153
153
|
const context = buildContext()
|
|
154
154
|
const caps = {
|
|
155
155
|
}
|
|
@@ -160,7 +160,7 @@ describe('compiler.compilertxt', function () {
|
|
|
160
160
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
161
161
|
})
|
|
162
162
|
it('should allow text starting with ##', async function () {
|
|
163
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
163
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_hashmark.convo.txt'))
|
|
164
164
|
const context = buildContext()
|
|
165
165
|
const caps = {
|
|
166
166
|
}
|
|
@@ -153,7 +153,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
153
153
|
})
|
|
154
154
|
describe('negating', function () {
|
|
155
155
|
it('should read ! as not', async function () {
|
|
156
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
156
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation.xlsx'))
|
|
157
157
|
const context = buildContext()
|
|
158
158
|
|
|
159
159
|
const caps = {
|
|
@@ -165,7 +165,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
165
165
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
166
166
|
})
|
|
167
167
|
it('should read !! as !', async function () {
|
|
168
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
168
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_exclamation.xlsx'))
|
|
169
169
|
const context = buildContext()
|
|
170
170
|
const caps = {
|
|
171
171
|
}
|
|
@@ -176,7 +176,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
176
176
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
177
177
|
})
|
|
178
178
|
it('should read n*! as (n-1)*!', async function () {
|
|
179
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
179
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_exclamation.xlsx'))
|
|
180
180
|
const context = buildContext()
|
|
181
181
|
|
|
182
182
|
const caps = {
|
|
@@ -188,7 +188,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
188
188
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
189
189
|
})
|
|
190
190
|
it('should read ! as ! in second line', async function () {
|
|
191
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
191
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation_secline.xlsx'))
|
|
192
192
|
const context = buildContext()
|
|
193
193
|
const caps = {
|
|
194
194
|
}
|
|
@@ -201,7 +201,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
201
201
|
})
|
|
202
202
|
describe('optional', function () {
|
|
203
203
|
it('should read ? as optional', async function () {
|
|
204
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
204
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question.xlsx'))
|
|
205
205
|
const context = buildContext()
|
|
206
206
|
|
|
207
207
|
const caps = {
|
|
@@ -213,7 +213,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
213
213
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
214
214
|
})
|
|
215
215
|
it('should read ?? as ?', async function () {
|
|
216
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
216
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question.xlsx'))
|
|
217
217
|
const context = buildContext()
|
|
218
218
|
const caps = {
|
|
219
219
|
}
|
|
@@ -224,7 +224,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
224
224
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
225
225
|
})
|
|
226
226
|
it('should read n*? as (n-1)*?', async function () {
|
|
227
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
227
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_question.xlsx'))
|
|
228
228
|
const context = buildContext()
|
|
229
229
|
|
|
230
230
|
const caps = {
|
|
@@ -236,7 +236,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
236
236
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
237
237
|
})
|
|
238
238
|
it('should read ? as ? in second line', async function () {
|
|
239
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
239
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_secline.xlsx'))
|
|
240
240
|
const context = buildContext()
|
|
241
241
|
const caps = {
|
|
242
242
|
}
|
|
@@ -249,7 +249,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
249
249
|
})
|
|
250
250
|
describe('optional and negate', function () {
|
|
251
251
|
it('should read ?! as optional and not', async function () {
|
|
252
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
252
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_exclamation.xlsx'))
|
|
253
253
|
const context = buildContext()
|
|
254
254
|
|
|
255
255
|
const caps = {}
|
|
@@ -261,7 +261,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
261
261
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
262
262
|
})
|
|
263
263
|
it('should read ??! as ?!', async function () {
|
|
264
|
-
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, '
|
|
264
|
+
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question_exclamation.xlsx'))
|
|
265
265
|
const context = buildContext()
|
|
266
266
|
const caps = {}
|
|
267
267
|
const compiler = new Compiler(context, Object.assign({}, DefaultCapabilities, caps))
|
|
File without changes
|
package/test/compiler/convos/md/{convos_with!_secline.md → convos_with_exclamation_secline.md}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/compiler/convos/md/{convos_with??!.md → convos_with_two_question_exclamation.md}
RENAMED
|
File without changes
|
package/test/compiler/convos/txt/{convos_with!.convo.txt → convos_with_exclamation.convo.txt}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/compiler/convos/txt/{convos_with????.convo.txt → convos_with_four_question.convo.txt}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/compiler/convos/txt/{convos_with!!.convo.txt → convos_with_two_exclamation.convo.txt}
RENAMED
|
File without changes
|
package/test/compiler/convos/txt/{convos_with??.convo.txt → convos_with_two_question.convo.txt}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/compiler/convos/xlsx/{convos_with!_secline.xlsx → convos_with_exclamation_secline.xlsx}
RENAMED
|
File without changes
|
package/test/compiler/convos/xlsx/{convos_with!!!!.xlsx → convos_with_four_exclamation.xlsx}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/compiler/convos/xlsx/{convos_with?!.xlsx → convos_with_question_exclamation.xlsx}
RENAMED
|
File without changes
|
package/test/compiler/convos/xlsx/{convos_with?_secline.xlsx → convos_with_question_secline.xlsx}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test/compiler/convos/xlsx/{convos_with??!.xlsx → convos_with_two_question_exclamation.xlsx}
RENAMED
|
File without changes
|