Skip to content

Commit

Permalink
all cloning tests are passing
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Bishop authored and Simon Bishop committed Apr 15, 2016
1 parent 71a1f8b commit 057d836
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 5 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
"bluebird": "2.10.2",
"body-parser": "1.14.1",
"byline": "4.2.1",
"clone": "1.0.2",
"clone": "^1.0.2",
"connect": "3.4.0",
"connect-cookies": "0.0.0",
"deep-copy": "^1.1.0",
"happn-logger": "0.0.1",
"happn-nedb": "^1.5.0",
"happn-util-crypto": "0.0.6",
"jwt-simple": "^0.2.0",
"lodash": "^4.11.1",
"lru-cache": "4.0.0",
"moment": "2.10.6",
"node-uuid": "^1.4.7",
Expand All @@ -44,6 +45,7 @@
"serve-static": "1.10.0",
"shortid": "2.2.4",
"sillyname": "^0.1.0",
"structured-clone": "^0.2.2",
"traverse": "0.6.6",
"underscore": "1.8.3",
"underscore.deep": "0.5.1",
Expand Down
65 changes: 61 additions & 4 deletions test/c8_cloning_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,77 @@ describe('c8_cloning_tests', function() {

});

xit('tests deepcopy', function(callback){
it('tests deepcopy', function(callback){
var deepCopy = require('deep-copy');
var itemsArray = [];

console.time("tests deepcopy");

for (var i = 0;i < 1000;i++)
itemsArray.push(deepCopy(objToClone));

console.timeEnd("tests deepcopy");

checkRandomItem(itemsArray, callback);
});

xit('tests Clone', function(callback){
it('tests lodash', function(callback){
var _ = require('lodash');
var itemsArray = [];

console.time("tests lodash");

for (var i = 0;i < 1000;i++)
itemsArray.push(_.cloneDeep(objToClone));

console.timeEnd("tests lodash");

checkRandomItem(itemsArray, callback);
});

xit('tests structured-clone', function(callback){
it('tests structured-clone', function(callback){
var clone = require('structured-clone');
var itemsArray = [];

console.time("tests structured-clone");

for (var i = 0;i < 1000;i++)
itemsArray.push(clone(objToClone));

console.timeEnd("tests structured-clone");

checkRandomItem(itemsArray, callback);
});

xit('tests structured-clone serialize once, deserialize multiple', function(callback){
it('tests structured-clone serialize once, deserialize multiple', function(callback){
var clone = require('structured-clone');
var itemsArray = [];

console.time("tests structured-clone serialize once, deserialize multiple");

var serialized = clone.serialize(objToClone);

for (var i = 0;i < 1000;i++)
itemsArray.push(clone.deserialize(serialized));

console.timeEnd("tests structured-clone serialize once, deserialize multiple");

checkRandomItem(itemsArray, callback);

});

it('tests clone', function(callback){
var clone = require('clone');
var itemsArray = [];

console.time("tests clone");

for (var i = 0;i < 1000;i++)
itemsArray.push(clone(objToClone));

console.timeEnd("tests clone");

checkRandomItem(itemsArray, callback);
});


Expand Down

0 comments on commit 057d836

Please sign in to comment.