botium-core 1.13.17 → 1.13.18

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.
@@ -0,0 +1,8 @@
1
+ custom embedded
2
+
3
+ #me
4
+ hello
5
+
6
+ #bot
7
+ hello fail
8
+ MY-LOGICHOOK-SKIP
@@ -0,0 +1,14 @@
1
+ {
2
+ "LOGIC_HOOKS": [
3
+ {
4
+ "ref": "MY-LOGICHOOK-SKIP",
5
+ "src": {
6
+ "onBotPrepare": "convoStep.skip = true"
7
+ },
8
+ "global": false,
9
+ "args": {
10
+ "my-arg-1": "something"
11
+ }
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,58 @@
1
+ const path = require('path')
2
+ const assert = require('chai').assert
3
+ const BotDriver = require('../../..').BotDriver
4
+ const Capabilities = require('../../..').Capabilities
5
+ const myCaps = require('./customEmbeddedSkip')
6
+
7
+ const echoConnector = () => ({ queueBotSays }) => {
8
+ return {
9
+ UserSays (msg) {
10
+ const botMsg = { sender: 'bot', sourceData: msg.sourceData, messageText: msg.messageText }
11
+ queueBotSays(botMsg)
12
+ }
13
+ }
14
+ }
15
+
16
+ const buildDriver = async (mergeCaps) => {
17
+ const myCaps = Object.assign({
18
+ [Capabilities.PROJECTNAME]: 'convo.customassertersskip',
19
+ [Capabilities.CONTAINERMODE]: echoConnector()
20
+ }, mergeCaps)
21
+
22
+ const result = {}
23
+ result.driver = new BotDriver(myCaps)
24
+ result.compiler = result.driver.BuildCompiler()
25
+ result.container = await result.driver.Build()
26
+ return result
27
+ }
28
+
29
+ describe('convo.customasserters skip', function () {
30
+ beforeEach(async function () {
31
+ const { compiler, container } = await buildDriver(myCaps)
32
+ this.compiler = compiler
33
+ this.container = container
34
+ await this.container.Start()
35
+ })
36
+ afterEach(async function () {
37
+ await this.container.Stop()
38
+ await this.container.Clean()
39
+ })
40
+
41
+ it('should success followed by another bot message', async function () {
42
+ this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'custom_embedded_skip.convo.txt')
43
+ const transript = await this.compiler.convos[0].Run(this.container)
44
+ assert.equal(transript.steps.length, 2)
45
+ })
46
+
47
+ it('should success followed by me message', async function () {
48
+ this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'custom_embedded_skip_followed_by_me.convo.txt')
49
+ const transript = await this.compiler.convos[0].Run(this.container)
50
+ assert.equal(transript.steps.length, 2)
51
+ })
52
+
53
+ it('should success followed by nothing', async function () {
54
+ this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'custom_embedded_skip_followed_by_nothing.convo.txt')
55
+ const transript = await this.compiler.convos[0].Run(this.container)
56
+ assert.equal(transript.steps.length, 1)
57
+ })
58
+ })