Commit 71085fbc authored by sergey's avatar sergey

add grunt coverage

add some tests
parent a08fa21f
node_modules/
coverage
html-report
\ No newline at end of file
module.exports = function(grunt){
grunt.initConfig({
mocha_istanbul: {
coverage: {
src: 'test',
options: {
'ui': 'tdd',
'recursive': true,
'reporter': 'mocha-istanbul'
}
}
}
});
grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.registerTask('coverage', ['mocha_istanbul:coverage']);
};
\ No newline at end of file
......@@ -19,8 +19,12 @@
},
"devDependencies": {
"expect.js": "*",
"grunt": "^0.4.5",
"grunt-mocha-istanbul": "^2.2.0",
"istanbul": "^0.3.5",
"memorystream": "^0.3.0",
"memstream": "*",
"mocha": "*"
"mocha": "*",
"mocha-istanbul": "^0.2.0"
}
}
......@@ -184,6 +184,34 @@ describe('Context', function() {
});
});
describe('say number', function() {
it('say number', function() {
this.context.sayNumber('1234', '#', function() {});
expect(this.context.sent.join('')).to.eql('SAY NUMBER 1234 "#"\n');
});
});
describe('say phonetic', function() {
it('say phonetic', function() {
this.context.sayPhonetic('1234ABCD', '#', function() {});
expect(this.context.sent.join('')).to.eql('SAY PHONETIC 1234ABCD "#"\n');
});
});
describe('context dial', function() {
it('context dial', function() {
this.context.dial('123', 10, 'A', function() {});
expect(this.context.sent.join('')).to.eql('EXEC Dial 123,10,A\n');
});
});
describe('say digits', function() {
it('say digits', function() {
this.context.sayDigits('1234', '#', function() {});
expect(this.context.sent.join('')).to.eql('SAY DIGITS 1234 "#"\n');
});
});
describe('waitForDigit', function() {
it('sends with default timeout', function() {
this.context.waitForDigit(function() {});
......@@ -203,6 +231,13 @@ describe('Context', function() {
});
});
describe('answer', function() {
it('sends "ANSWER\\n"', function() {
this.context.answer();
expect(this.context.sent.join('')).to.eql('ANSWER\n');
});
});
describe('events', function() {
describe('error', function () {
it('is emitted when socket emits error', function(done) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment