hubot 11.1.0 → 11.1.2
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/LICENSE.md +1 -1
- package/README.md +12 -0
- package/package.json +2 -2
- package/src/GenHubot.mjs +12 -2
- package/src/Robot.mjs +5 -5
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -36,3 +36,15 @@ Review `scripts/example.mjs`. Create more scripts in the `scripts` folder.
|
|
|
36
36
|
## License
|
|
37
37
|
|
|
38
38
|
See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).
|
|
39
|
+
|
|
40
|
+
# Hubot History
|
|
41
|
+
|
|
42
|
+
[Cartoon with Hubot](https://www.youtube.com/watch?v=vq2jYFZVMDA&t=129s)
|
|
43
|
+
|
|
44
|
+
[The Most Important Startup's Hardest Worker Isn't a Person](https://www.wired.com/2015/10/the-most-important-startups-hardest-worker-isnt-a-person/)
|
|
45
|
+
|
|
46
|
+
[The Story of Hubot](https://www.youtube.com/watch?v=Je4TjjtFDNU)
|
|
47
|
+
|
|
48
|
+
[Hubot by Hubotics](https://www.theoldrobots.com/hubot.html)
|
|
49
|
+
|
|
50
|
+
[Automating Inefficiencies](https://zachholman.com/2011/01/automating-inefficiencies/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hubot",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.2",
|
|
4
4
|
"author": "hubot",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"connect-multiparty": "^2.2.0",
|
|
19
|
-
"express": "^4.
|
|
19
|
+
"express": "^4.19.2",
|
|
20
20
|
"express-basic-auth": "^1.2.1",
|
|
21
21
|
"pino": "^8.11.0"
|
|
22
22
|
},
|
package/src/GenHubot.mjs
CHANGED
|
@@ -56,6 +56,9 @@ export default (robot) => {
|
|
|
56
56
|
robot.respond(/helo room/, async res => {
|
|
57
57
|
await res.send('Hello World!')
|
|
58
58
|
})
|
|
59
|
+
robot.router.get('/helo', async (req, res) => {
|
|
60
|
+
res.send("HELO World! I'm Dumbotheelephant.")
|
|
61
|
+
})
|
|
59
62
|
}`)
|
|
60
63
|
|
|
61
64
|
File.writeFileSync('./tests/doubles/DummyAdapter.mjs', `
|
|
@@ -125,14 +128,21 @@ export default (robot) => {
|
|
|
125
128
|
describe('Xample testing Hubot scripts', () => {
|
|
126
129
|
let robot = null
|
|
127
130
|
beforeEach(async () => {
|
|
128
|
-
robot = new Robot(dummyRobot,
|
|
131
|
+
robot = new Robot(dummyRobot, true, 'Dumbotheelephant')
|
|
129
132
|
await robot.loadAdapter()
|
|
130
|
-
await robot.loadFile('./scripts', 'Xample.mjs')
|
|
131
133
|
await robot.run()
|
|
134
|
+
await robot.loadFile('./scripts', 'Xample.mjs')
|
|
132
135
|
})
|
|
133
136
|
afterEach(() => {
|
|
134
137
|
robot.shutdown()
|
|
135
138
|
})
|
|
139
|
+
it('should handle /helo request', async () => {
|
|
140
|
+
const expected = "HELO World! I'm Dumbotheelephant."
|
|
141
|
+
const url = 'http://localhost:' + robot.server.address().port + '/helo'
|
|
142
|
+
const response = await fetch(url)
|
|
143
|
+
const actual = await response.text()
|
|
144
|
+
assert.strictEqual(actual, expected)
|
|
145
|
+
})
|
|
136
146
|
it('should reply with expected message', async () => {
|
|
137
147
|
const expected = "HELO World! I'm Dumbotheelephant."
|
|
138
148
|
const user = robot.brain.userForId('test-user', { name: 'test user' })
|
package/src/Robot.mjs
CHANGED
|
@@ -470,12 +470,12 @@ class Robot {
|
|
|
470
470
|
// returns nothing
|
|
471
471
|
setupNullRouter () {
|
|
472
472
|
const msg = 'A script has tried registering a HTTP route while the HTTP server is disabled with --disabled-httpd.'
|
|
473
|
-
|
|
473
|
+
const self = this
|
|
474
474
|
this.router = {
|
|
475
|
-
get: () =>
|
|
476
|
-
post: () =>
|
|
477
|
-
put: () =>
|
|
478
|
-
delete: () =>
|
|
475
|
+
get: () => self.logger.info(msg),
|
|
476
|
+
post: () => self.logger.info(msg),
|
|
477
|
+
put: () => self.logger.info(msg),
|
|
478
|
+
delete: () => self.logger.info(msg)
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
|