-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36073f5
commit ee7a6f8
Showing
2 changed files
with
12 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,21 @@ | ||
'use strict' | ||
|
||
/* global describe, it */ | ||
/* eslint-disable no-unused-expressions */ | ||
const shell = require('hubot/src/adapters/shell') | ||
const Adapter = require('hubot/src/adapter') | ||
|
||
const { describe, it } = require('node:test') | ||
const assert = require('node:assert/strict') | ||
const path = require('path') | ||
|
||
const chai = require('chai') | ||
const sinon = require('sinon') | ||
const Hubot = require('hubot') | ||
|
||
const expect = chai.expect | ||
const Robot = Hubot.Robot | ||
|
||
chai.use(require('sinon-chai')) | ||
|
||
const Robot = require('hubot/src/robot.js') | ||
describe('e2e', () => { | ||
it('connects to redis', done => { | ||
shell.use = robot => { | ||
return new Adapter() | ||
} | ||
|
||
const robot = new Robot(null, 'shell', false, 'hubot') | ||
sinon.spy(robot.logger, 'debug') | ||
it('connects to redis', async () => { | ||
const robot = new Robot('shell', false, 'hubot') | ||
await robot.loadAdapter() | ||
robot.brain.on('loaded', actual => { | ||
const expected = { users: {}, _private: {} } | ||
expect(actual).to.deep.equal(expected) | ||
assert.deepEqual(actual, expected) | ||
}) | ||
robot.brain.on('connected', () => { | ||
expect(robot.logger.debug).to.have.been.calledWith('hubot-redis-brain: Successfully connected to Redis') | ||
robot.shutdown() | ||
done() | ||
assert.ok(true) | ||
}) | ||
robot.loadFile(path.resolve('src/'), 'redis-brain.js') | ||
robot.run() | ||
await robot.loadFile(path.resolve('src/'), 'redis-brain.js') | ||
await robot.run() | ||
robot.shutdown() | ||
}) | ||
}) |