Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/unresponsive-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ const Behaviors = require('../src/behaviors');

const responseTime = 100;
const offsetTime = 100;
const standardResponse = 'Hi, looks like nobody\'s around just now. If you have a question, you can post it a https://publiclab.org/questions, or if you need help with a software issue, you can open an issue at https://github.com/publiclab/plots2/issues/new -- thanks!';
const standardResponse = '';

describe('Unresponsive Behavior', () => {
const botNick = 'testbot';
const unresponsiveBehavior = require('../src/behaviors/unresponsive')({ responseTime, offsetTime });
const behaviors = new Behaviors(botNick, undefined, [], [unresponsiveBehavior]);

it('should print the message if nobody responds for 10 ms', (done) => {
it('should not print any message if nobody responds for 10 ms', (done) => {
behaviors.getResponse('user', botNick, 'hello').then(response => {
expect(response).toBe(standardResponse);
done();
Expand Down
2 changes: 1 addition & 1 deletion src/behaviors/unresponsive.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = ({ responseTime, offsetTime }) => {
return new Promise((resolve, reject) => {
currentTimeout = setTimeout(() => {
currentTimeout = undefined;
resolve('Hi, looks like nobody\'s around just now. If you have a question, you can post it a https://publiclab.org/questions, or if you need help with a software issue, you can open an issue at https://github.com/publiclab/plots2/issues/new -- thanks!');
resolve('');
}, responseTime);

setTimeout(() => {
Expand Down