documentdb-mock
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -40,3 +40,3 @@ // Generated by CoffeeScript 1.9.3 | ||
this.nextError = null; | ||
this.nextResources = []; | ||
this.nextResources = {}; | ||
this.nextOptions = {}; | ||
@@ -82,2 +82,5 @@ this.nextCollectionOperationQueued = true; | ||
return { | ||
getSelfLink: function() { | ||
return 'mocked-self-link'; | ||
}, | ||
queryDocuments: function(lastEntityLink, lastQueryFilter, lastOptions, callback) { | ||
@@ -87,2 +90,6 @@ _this.lastEntityLink = lastEntityLink; | ||
_this.lastOptions = lastOptions; | ||
if (typeof _this.lastOptions === 'function') { | ||
callback = _this.lastOptions; | ||
_this.lastOptions = null; | ||
} | ||
_this._shiftNextCollectionOperationQueued(); | ||
@@ -98,2 +105,6 @@ if (_this.nextCollectionOperationQueued) { | ||
_this.lastOptions = lastOptions; | ||
if (typeof _this.lastOptions === 'function') { | ||
callback = _this.lastOptions; | ||
_this.lastOptions = null; | ||
} | ||
_this._shiftNextCollectionOperationQueued(); | ||
@@ -106,5 +117,2 @@ if (_this.nextCollectionOperationQueued) { | ||
}, | ||
getSelfLink: function() { | ||
return 'mocked-self-link'; | ||
}, | ||
createDocument: function(lastEntityLink, lastRow, lastOptions, callback) { | ||
@@ -114,2 +122,6 @@ _this.lastEntityLink = lastEntityLink; | ||
_this.lastOptions = lastOptions; | ||
if (typeof _this.lastOptions === 'function') { | ||
callback = _this.lastOptions; | ||
_this.lastOptions = null; | ||
} | ||
_this._shiftNextCollectionOperationQueued(); | ||
@@ -128,2 +140,6 @@ if (_this.nextCollectionOperationQueued) { | ||
_this.lastOptions = lastOptions; | ||
if (typeof _this.lastOptions === 'function') { | ||
callback = _this.lastOptions; | ||
_this.lastOptions = null; | ||
} | ||
_this._shiftNextCollectionOperationQueued(); | ||
@@ -141,2 +157,6 @@ if (_this.nextCollectionOperationQueued) { | ||
_this.lastOptions = lastOptions; | ||
if (typeof _this.lastOptions === 'function') { | ||
callback = _this.lastOptions; | ||
_this.lastOptions = null; | ||
} | ||
if (((ref = _this.lastRow) != null ? ref.id : void 0) == null) { | ||
@@ -158,2 +178,6 @@ throw new Error("The input content is invalid because the required property, id, is missing."); | ||
_this.lastOptions = lastOptions; | ||
if (typeof _this.lastOptions === 'function') { | ||
callback = _this.lastOptions; | ||
_this.lastOptions = null; | ||
} | ||
_this._shiftNextCollectionOperationQueued(); | ||
@@ -160,0 +184,0 @@ if (_this.nextCollectionOperationQueued) { |
{ | ||
"name": "documentdb-mock", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Mock for testing Stored Procedures in Microsoft Azure's DocumentDB", | ||
@@ -39,3 +39,3 @@ "main": "./DocumentDBMock", | ||
"dependencies": { | ||
"documentdb": "^1.0.0", | ||
"documentdb": "^1.1.0", | ||
"documentdb-utils": "^0.3.0", | ||
@@ -42,0 +42,0 @@ "rewire": "^2.3.3" |
@@ -197,2 +197,3 @@ # DocumentDBMock # | ||
* 0.1.4 - 2015-07-09 - Now correctly supports missing options parameter. Also fixed createVariedDocuments to use callback, which exposed the problem with the optional options parameter. | ||
* 0.1.3 - 2015-07-07 - Lots of little fixes found when using to test documentdb-lumenize | ||
@@ -199,0 +200,0 @@ * 0.1.2 - 2015-06-30 - Fixed src examples broken when this was split from documentdb-utils |
@@ -6,3 +6,3 @@ // Generated by CoffeeScript 1.9.2 | ||
generateData = function(memo) { | ||
var collection, collectionLink, getIndex, getRandomValue, i, key, keys, len, nowTime, possibleValues, row, startTime, timeout, value; | ||
var collection, collectionLink, createDocument, getIndex, getRandomValue, key, keys, possibleValues, value; | ||
if ((memo != null ? memo.remaining : void 0) == null) { | ||
@@ -15,5 +15,2 @@ throw new Error('generateData must be called with an object containing a `remaining` field.'); | ||
memo.countForThisRun = 0; | ||
timeout = memo.timeout || 500; | ||
startTime = new Date(); | ||
memo.stillTime = true; | ||
possibleValues = { | ||
@@ -46,27 +43,33 @@ ProjectHierarchy: [[1, 2, 3], [1, 2, 4], [1, 2], [5], [5, 6]], | ||
memo.stillQueueing = true; | ||
while (memo.remaining > 0 && memo.stillQueueing && memo.stillTime) { | ||
row = {}; | ||
for (i = 0, len = keys.length; i < len; i++) { | ||
key = keys[i]; | ||
row[key] = getRandomValue(possibleValues[key]); | ||
} | ||
getContext().getResponse().setBody(memo); | ||
memo.stillQueueing = collection.createDocument(collectionLink, row); | ||
if (memo.stillQueueing) { | ||
memo.remaining--; | ||
memo.countForThisRun++; | ||
memo.totalCount++; | ||
} | ||
nowTime = new Date(); | ||
memo.nowTime = nowTime; | ||
memo.startTime = startTime; | ||
memo.stillTime = (nowTime - startTime) < timeout; | ||
if (memo.stillTime) { | ||
createDocument = function() { | ||
var i, len, row; | ||
if (memo.remaining > 0 && memo.stillQueueing) { | ||
row = {}; | ||
for (i = 0, len = keys.length; i < len; i++) { | ||
key = keys[i]; | ||
row[key] = getRandomValue(possibleValues[key]); | ||
} | ||
getContext().getResponse().setBody(memo); | ||
return memo.stillQueueing = collection.createDocument(collectionLink, row, function(error, resource, options) { | ||
if (error != null) { | ||
throw new Error(error); | ||
} else if (memo.stillQueueing) { | ||
memo.remaining--; | ||
memo.countForThisRun++; | ||
memo.totalCount++; | ||
return createDocument(); | ||
} else if (memo.remaining > 0) { | ||
memo.continuation = 'Value does not matter'; | ||
return getContext().getResponse().setBody(memo); | ||
} else { | ||
memo.continuation = null; | ||
return getContext().getResponse().setBody(memo); | ||
} | ||
}); | ||
} else { | ||
memo.continuation = null; | ||
} else { | ||
memo.continuation = 'Value does not matter'; | ||
return getContext().getResponse().setBody(memo); | ||
} | ||
} | ||
getContext().getResponse().setBody(memo); | ||
return memo; | ||
}; | ||
return createDocument(); | ||
}; | ||
@@ -73,0 +76,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
230
0
28780
9
477
Updateddocumentdb@^1.1.0