hubot 11.1.0 → 11.1.1

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 CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2023 GitHub Inc.
1
+ Copyright (c) 2011-2024 GitHub Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hubot",
3
- "version": "11.1.0",
3
+ "version": "11.1.1",
4
4
  "author": "hubot",
5
5
  "keywords": [
6
6
  "github",
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, false, 'Dumbotheelephant')
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: () => this.logger.warning(msg),
476
- post: () => this.logger.warning(msg),
477
- put: () => this.logger.warning(msg),
478
- delete: () => this.logger.warning(msg)
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