You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@senssoft.apache.org by rf...@apache.org on 2016/09/20 21:03:54 UTC
[3/8] incubator-senssoft-useralejs git commit: Added test for custom
logs. Finished converting to ES6.
Added test for custom logs. Finished converting to ES6.
Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/commit/bcb96cbc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/tree/bcb96cbc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/diff/bcb96cbc
Branch: refs/heads/master
Commit: bcb96cbc9cb569fb28a09f2c0c624acec4f05c86
Parents: 355f4c2
Author: Rob Foley <ro...@gmail.com>
Authored: Tue Sep 20 10:37:02 2016 -0400
Committer: Rob Foley <ro...@gmail.com>
Committed: Tue Sep 20 10:37:02 2016 -0400
----------------------------------------------------------------------
test/main_spec.js | 45 ++++++++++++++++++++++++++++++++-------------
1 file changed, 32 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-useralejs/blob/bcb96cbc/test/main_spec.js
----------------------------------------------------------------------
diff --git a/test/main_spec.js b/test/main_spec.js
index 0a820b4..611a06d 100644
--- a/test/main_spec.js
+++ b/test/main_spec.js
@@ -6,7 +6,7 @@ describe('Userale API', () => {
var file = 'file://' + __dirname + '/main.html';
var html = fs.readFileSync(__dirname + '/main.html');
- it('provides configs', function(done) {
+ it('provides configs', (done) => {
jsdom.env({
html : html,
url : file,
@@ -14,8 +14,8 @@ describe('Userale API', () => {
FetchExternalResources : ['script'],
ProcessExternalResources : ['script']
},
- done : function(err, window) {
- var config = window.userale.options();
+ done : (err, window) => {
+ const config = window.userale.options();
expect(config).to.be.an('object');
expect(config).to.have.all.keys([
'on',
@@ -38,7 +38,7 @@ describe('Userale API', () => {
});
});
- it('edits configs', function(done) {
+ it('edits configs', (done) => {
jsdom.env({
html : html,
url : file,
@@ -46,13 +46,13 @@ describe('Userale API', () => {
FetchExternalResources : ['script'],
ProcessExternalResources : ['script']
},
- done : function(err, window) {
- var config = window.userale.options();
- var interval = config.transmitInterval;
+ done : (err, window) => {
+ const config = window.userale.options();
+ const interval = config.transmitInterval;
window.userale.options({
transmitInterval : interval + 10
});
- var newConfig = window.userale.options();
+ const newConfig = window.userale.options();
expect(newConfig.transmitInterval).to.equal(interval + 10);
window.close();
@@ -61,7 +61,7 @@ describe('Userale API', () => {
});
});
- it('starts + stops', function(done) {
+ it('starts + stops', (done) => {
jsdom.env({
html : html,
url : file,
@@ -69,9 +69,9 @@ describe('Userale API', () => {
FetchExternalResources : ['script'],
ProcessExternalResources : ['script']
},
- done : function(err, window) {
- setTimeout(function() {
- var userale = window.userale;
+ done : (err, window) => {
+ setTimeout(() => {
+ const { userale } = window;
expect(userale.options().on).to.equal(true);
userale.stop();
@@ -87,5 +87,24 @@ describe('Userale API', () => {
});
});
- it('sends custom logs');
+ it('sends custom logs', (done) => {
+ jsdom.env({
+ html: html,
+ url: file,
+ features : {
+ FetchExternalResources : ['script'],
+ ProcessExternalResources : ['script']
+ },
+ done: (err, window) => {
+ const { userale } = window;
+
+ expect(userale.log({})).to.equal(true);
+ expect(userale.log()).to.equal(false);
+ expect(userale.log(null)).to.equal(false);
+
+ window.close();
+ done();
+ }
+ });
+ });
});