Permalink
Please sign in to comment.
Showing
with
144 additions
and 213 deletions.
- +0 −23 docs/.eslintrc
- +0 −24 docs/eslintrc.yaml
- +1 −1 gulpfile.js
- +1 −13 lib/bot/BotCommands.js
- +1 −3 lib/bot/cmds/thanks.js
- +6 −4 lib/utils/Utils.js
- +3 −10 package.json
- +132 −135 test/TestHelper.js
23
docs/.eslintrc
| @@ -1,23 +0,0 @@ | ||
| -{ | ||
| - "env": { | ||
| - "browser": 0 | ||
| - }, | ||
| - | ||
| - "globals": { | ||
| - "require": 1, | ||
| - "console": 1 | ||
| - "module": 1 | ||
| - }, | ||
| - | ||
| - "rules": { | ||
| - "quotes": [2, "double"], | ||
| - "strict": [2, "global"], | ||
| - "no-console": 0 | ||
| - }, | ||
| - | ||
| - "ecmaFeatures": { | ||
| - "blockBindings": true, | ||
| - "forOf": true, | ||
| - "jsx": true | ||
| - }, | ||
| -} |
24
docs/eslintrc.yaml
| @@ -1,24 +0,0 @@ | ||
| -rules: | ||
| - indent: | ||
| - - 2 | ||
| - - 4 | ||
| - quotes: | ||
| - - 2 | ||
| - - double | ||
| - linebreak-style: | ||
| - - 2 | ||
| - - unix | ||
| - semi: | ||
| - - 2 | ||
| - - always | ||
| - | ||
| - no-unused-vars: | ||
| - - 2 | ||
| - - | ||
| - vars: "none" | ||
| - args: "after-used" | ||
| - | ||
| - | ||
| -env: | ||
| - es6: true | ||
| - node: true |
2
gulpfile.js
14
lib/bot/BotCommands.js
4
lib/bot/cmds/thanks.js
10
lib/utils/Utils.js
13
package.json
267
test/TestHelper.js
| @@ -1,150 +1,147 @@ | ||
| -"use strict"; | ||
| +'use strict'; | ||
| +const GBot = require('../lib/bot/GBot'); | ||
| -var GBot = require('../lib/bot/GBot'); | ||
| - | ||
| -var TestHelper = { | ||
| - aboutInput: { | ||
| - keyword: 'about', | ||
| - params: '@bothelp ', | ||
| - message: { | ||
| - operation: 'create', | ||
| - model: { | ||
| - id: '55b95acb5bc8dc88744243ff', | ||
| - text: 'about @bothelp', | ||
| - html: 'about <span data-link-type="mention" data-screen-name="bothelp" class="mention">@bothelp</span> ', | ||
| - sent: '2015-07-29T22:59:23.187Z', | ||
| - editedAt: null, | ||
| - fromUser: { | ||
| - username: "testuser" | ||
| - }, | ||
| - unread: true, | ||
| - readBy: 0, | ||
| - urls: [], | ||
| - mentions: [ | ||
| - {screenName: 'dcsan'}, | ||
| - {screenName: 'berkeleytrue'} | ||
| - ], | ||
| - issues: [], | ||
| - meta: {}, | ||
| - v: 1 | ||
| - }, | ||
| - room: { | ||
| - path: '/rooms', | ||
| - id: '55b3d5780fc9f982beaaf7f4', | ||
| - name: 'camperbot/localdev', | ||
| - topic: ' testing', | ||
| - uri: 'camperbot/localdev', | ||
| - oneToOne: false, | ||
| - userCount: 5, | ||
| - unreadItems: 100, | ||
| - mentions: 27, | ||
| - lastAccessTime: '2015-07-29T14:41:04.820Z', | ||
| - lurk: false, | ||
| - url: '/camperbot/localdev', | ||
| - githubType: 'USER_CHANNEL', | ||
| - security: 'PUBLIC', | ||
| - noindex: false, | ||
| - v: 1, | ||
| - client: [Object], | ||
| - faye: [Object], | ||
| - _events: [Object] | ||
| - } | ||
| +const TestHelper = { | ||
| + aboutInput: { | ||
| + keyword: 'about', | ||
| + params: '@bothelp ', | ||
| + message: { | ||
| + operation: 'create', | ||
| + model: { | ||
| + id: '55b95acb5bc8dc88744243ff', | ||
| + text: 'about @bothelp', | ||
| + html: 'about <span data-link-type="mention" data-screen-name' + | ||
| + '="bothelp" class="mention">@bothelp</span> ', | ||
| + sent: '2015-07-29T22:59:23.187Z', | ||
| + editedAt: null, | ||
| + fromUser: { | ||
| + username: 'testuser' | ||
| }, | ||
| - cleanText: 'about @bothelp ', | ||
| - command: true | ||
| + unread: true, | ||
| + readBy: 0, | ||
| + urls: [], | ||
| + mentions: [ | ||
| + {screenName: 'dcsan'}, | ||
| + {screenName: 'berkeleytrue'} | ||
| + ], | ||
| + issues: [], | ||
| + meta: {}, | ||
| + v: 1 | ||
| + }, | ||
| + room: { | ||
| + path: '/rooms', | ||
| + id: '55b3d5780fc9f982beaaf7f4', | ||
| + name: 'camperbot/localdev', | ||
| + topic: ' testing', | ||
| + uri: 'camperbot/localdev', | ||
| + oneToOne: false, | ||
| + userCount: 5, | ||
| + unreadItems: 100, | ||
| + mentions: 27, | ||
| + lastAccessTime: '2015-07-29T14:41:04.820Z', | ||
| + lurk: false, | ||
| + url: '/camperbot/localdev', | ||
| + githubType: 'USER_CHANNEL', | ||
| + security: 'PUBLIC', | ||
| + noindex: false, | ||
| + v: 1, | ||
| + client: [Object], | ||
| + faye: [Object], | ||
| + _events: [Object] | ||
| + } | ||
| }, | ||
| + cleanText: 'about @bothelp ', | ||
| + command: true | ||
| + }, | ||
| - stubInput: { | ||
| - keyword: 'hint', | ||
| - params: undefined, | ||
| - message: { | ||
| - operation: 'create', | ||
| - model: { | ||
| - id: '55b91175c35e438c74fc725c', | ||
| - text: 'hint', | ||
| - html: 'hint', | ||
| - sent: '2015-07-29T17:46:29.190Z', | ||
| - editedAt: null, | ||
| - fromUser: [Object], | ||
| - unread: true, | ||
| - readBy: 0, | ||
| - urls: [], | ||
| - mentions: [], | ||
| - issues: [], | ||
| - meta: {}, | ||
| - v: 1 | ||
| - }, | ||
| - room: { | ||
| - path: '/rooms', | ||
| - id: '55b8fc980fc9f982beab6b19', | ||
| - name: 'bothelp/bonfire-factorialize-a-number', | ||
| - topic: '', | ||
| - uri: 'bothelp/bonfire-factorialize-a-number', | ||
| - oneToOne: false, | ||
| - userCount: 3, | ||
| - unreadItems: 9, | ||
| - mentions: 0, | ||
| - lastAccessTime: '2015-07-29T16:17:28.850Z', | ||
| - lurk: false, | ||
| - url: '/bothelp/bonfire-factorialize-a-number', | ||
| - githubType: 'USER_CHANNEL', | ||
| - security: 'PUBLIC', | ||
| - noindex: false, | ||
| - client: [Object], | ||
| - faye: [Object], | ||
| - _events: [Object] | ||
| - } | ||
| - }, | ||
| - cleanText: 'hint', | ||
| - command: true | ||
| + stubInput: { | ||
| + keyword: 'hint', | ||
| + params: null, | ||
| + message: { | ||
| + operation: 'create', | ||
| + model: { | ||
| + id: '55b91175c35e438c74fc725c', | ||
| + text: 'hint', | ||
| + html: 'hint', | ||
| + sent: '2015-07-29T17:46:29.190Z', | ||
| + editedAt: null, | ||
| + fromUser: [Object], | ||
| + unread: true, | ||
| + readBy: 0, | ||
| + urls: [], | ||
| + mentions: [], | ||
| + issues: [], | ||
| + meta: {}, | ||
| + v: 1 | ||
| + }, | ||
| + room: { | ||
| + path: '/rooms', | ||
| + id: '55b8fc980fc9f982beab6b19', | ||
| + name: 'bothelp/bonfire-factorialize-a-number', | ||
| + topic: '', | ||
| + uri: 'bothelp/bonfire-factorialize-a-number', | ||
| + oneToOne: false, | ||
| + userCount: 3, | ||
| + unreadItems: 9, | ||
| + mentions: 0, | ||
| + lastAccessTime: '2015-07-29T16:17:28.850Z', | ||
| + lurk: false, | ||
| + url: '/bothelp/bonfire-factorialize-a-number', | ||
| + githubType: 'USER_CHANNEL', | ||
| + security: 'PUBLIC', | ||
| + noindex: false, | ||
| + client: [Object], | ||
| + faye: [Object], | ||
| + _events: [Object] | ||
| + } | ||
| }, | ||
| + cleanText: 'hint', | ||
| + command: true | ||
| + }, | ||
| - mockInput: function(roomName) { | ||
| - var input = { | ||
| - message: { | ||
| - room: { | ||
| - name: roomName | ||
| - } | ||
| - } | ||
| - }; | ||
| - // clog(input); | ||
| - return input; | ||
| - }, | ||
| + mockInput: function(roomName) { | ||
| + const input = { | ||
| + message: { | ||
| + room: { | ||
| + name: roomName | ||
| + } | ||
| + } | ||
| + }; | ||
| - // used for tests | ||
| - // and also strings to commands | ||
| - // https://developer.gitter.im/docs/messages-resource | ||
| - // makeInputFromString: function (text) { | ||
| - // var message = {}; | ||
| - // var model = { | ||
| - // text: text | ||
| - // }; | ||
| - // message.model = model; | ||
| - // return message; | ||
| - // }, | ||
| + return input; | ||
| + }, | ||
| - makeInputFromString: function (text) { | ||
| - var input = TestHelper.aboutInput; | ||
| - input.message.model.text = text; // initialize before parsing | ||
| - //console.log("input1", input); | ||
| - input = GBot.parseInput(input.message); // add keywords etc. | ||
| - //console.log("input2", input); | ||
| - input.message.model.text = text; | ||
| - input.message.model.fromUser = { | ||
| - username: "testuser" | ||
| - }; | ||
| - return input; | ||
| - }, | ||
| + // used for tests | ||
| + // and also strings to commands | ||
| + // https://developer.gitter.im/docs/messages-resource | ||
| + // makeInputFromString: function (text) { | ||
| + // var message = {}; | ||
| + // var model = { | ||
| + // text: text | ||
| + // }; | ||
| + // message.model = model; | ||
| + // return message; | ||
| + // }, | ||
| - makeMessageFromString: function (text) { | ||
| - var input = TestHelper.makeInputFromString(text); | ||
| - return input.message; | ||
| - } | ||
| + makeInputFromString: function(text) { | ||
| + let input = TestHelper.aboutInput; | ||
| + // initialize before parsing | ||
| + input.message.model.text = text; | ||
| + // add keywords etc. | ||
| + input = GBot.parseInput(input.message); | ||
| + input.message.model.text = text; | ||
| + input.message.model.fromUser = { | ||
| + username: 'testuser' | ||
| + }; | ||
| + return input; | ||
| + }, | ||
| + makeMessageFromString: function(text) { | ||
| + const input = TestHelper.makeInputFromString(text); | ||
| + return input.message; | ||
| + } | ||
| }; | ||
| - | ||
| - | ||
| module.exports = TestHelper; |
0 comments on commit
3e271a1