Create an example that includes tests and how to run them. #122 (#130)

This commit is contained in:
Mykyta Khmel
2016-12-01 01:09:28 +02:00
committed by Kumar McMillan
parent 01181a350b
commit 395786e353
19 changed files with 214 additions and 0 deletions
@@ -0,0 +1,11 @@
describe('Background', function() {
describe('ping', function() {
it('should return pong in response', function() {
// Return a promise for Mocha using the Firefox browser API instead of chrome.
return browser.runtime.sendMessage({action: 'ping'})
.then(function(response) {
expect(response).to.equal('pong');
});
});
});
});
@@ -0,0 +1,8 @@
describe('Array', function() {
describe('#indexOf()', function() {
it('should return -1 when the value is not present', function() {
expect([1,2,3]).to.not.contain(5);
expect([1,2,3]).to.not.contain(0);
});
});
});
@@ -0,0 +1,5 @@
mocha.checkLeaks();
// Here we add initial global variables to prevent this error:
// Error: global leaks detected: AppView, ExtensionOptions, ExtensionView, WebView
mocha.globals(['AppView', 'ExtensionOptions', 'ExtensionView', 'WebView']);
mocha.run();
@@ -0,0 +1 @@
mocha.setup('bdd');