This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
10 changed files
with
116 additions
and
47 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const fs = require('fs'); | ||
if (fs.existsSync('./.env')) { | ||
console.log('Found env file'); | ||
const env = require('node-env-file'); | ||
env('./.env'); | ||
} | ||
|
||
const chai = require('chai'); | ||
chai.should(); | ||
const chaiAsPromised = require("chai-as-promised"); | ||
|
||
chai.use(chaiAsPromised); | ||
chai.use(require('chai-things')); | ||
|
||
const qnaController = require('../src/qnaController'); | ||
|
||
var mongoose = require('mongoose'); | ||
mongoose.Promise = global.Promise; | ||
|
||
describe('Controller ', function () { | ||
it('Should connect to MongoDB', function (done) { | ||
if (!mongoose.connection.readyState) | ||
mongoose.connect(process.env.mongo, { | ||
useMongoClient: true}); | ||
mongoose.connection.once('open', function () { | ||
mongoose.connection.readyState.should.equal(1); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Function: Format Text', function () { | ||
it('Should remove bot name from message.text', function () { | ||
let message = { | ||
text: `${process.env.bot_name} test` | ||
} | ||
qnaController.formatText(message).text.should.equal(' test') | ||
}); | ||
}); | ||
|
||
describe('Controller Database Functions', function() { | ||
it('Should GET MOTDs', function() { | ||
return qnaController.getMotd().should.eventually.be.an('array'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
Empty file.
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const chai = require('chai'); | ||
chai.should() | ||
|
||
const sinon = require('sinon'); | ||
const expect = chai.expect; | ||
|
||
|
||
|
||
describe('Hello Skills Test', function() { | ||
it('Should respond to Hello', function() { | ||
let mdMessage = 'Welcome. I am the *Inquire Bot*. I will help you ask questions and get answers! Please refer to the ``help`` command for more information. '; | ||
let bot = { | ||
reply: function() { | ||
|
||
} | ||
}; | ||
let mBot = sinon.mock(bot); | ||
let controller = { | ||
hears: function(string1, string2, callback) { | ||
} | ||
}; | ||
let message = 'Hello'; | ||
let mController = sinon.mock(controller); | ||
mController.expects('hears').once().withArgs(sinon.match.array, sinon.match.string, sinon.match.func).yields(bot, message); | ||
mBot.expects('reply').withArgs(sinon.match.string, sinon.match({markdown: mdMessage})); | ||
const hello = require('../src/skills/hello')(controller); | ||
mBot.verify(); | ||
mController.verify(); | ||
}) | ||
}); | ||
|
||
describe('Help Skills Test', function() { | ||
it('Should respond to Help', function() { | ||
let bot = { | ||
reply: function() { | ||
|
||
}, | ||
startPrivateConversation: function() { | ||
} | ||
}; | ||
let mBot = sinon.mock(bot); | ||
let controller = { | ||
hears: function(string1, string2, callback) { | ||
} | ||
}; | ||
let message = 'Hello'; | ||
let mController = sinon.mock(controller); | ||
mController.expects('hears').atLeast(2).withArgs(sinon.match.array, sinon.match.string, sinon.match.func).yields(bot, message); | ||
mBot.expects('reply').atLeast(2).withArgs(sinon.match.string, sinon.match({markdown: sinon.match.string})); | ||
mBot.expects('startPrivateConversation').withArgs(sinon.match.string, sinon.match.func); | ||
const hello = require('../src/skills/help')(controller); | ||
mBot.verify(); | ||
mController.verify(); | ||
}) | ||
}); |