Skip to content

Commit 9a3bd15

Browse files
committed
Fixed some error messages.
Stable Version 0.5.2.
1 parent 2cb5597 commit 9a3bd15

6 files changed

Lines changed: 24 additions & 22 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "Jason Dobry",
33
"name": "angular-data-mocks",
44
"description": "A mock of angular-data for testing purposes.",
5-
"version": "0.5.1",
5+
"version": "0.5.2",
66
"homepage": "https://github.com/jmdobry/angular-data-mocks/",
77
"repository": {
88
"type": "git",

dist/angular-data-mocks.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @author Jason Dobry <jason.dobry@gmail.com>
44
* @file angular-data-mocks.js
5-
* @version 0.5.1 - Homepage <https://github.com/jmdobry/angular-data-mocks>
5+
* @version 0.5.2 - Homepage <https://github.com/jmdobry/angular-data-mocks>
66
* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/>
77
* @license MIT <https://github.com/jmdobry/angular-data-mocks/blob/master/LICENSE>
88
*
@@ -92,11 +92,11 @@ function DSHttpAdapterProvider() {
9292
* @param {number=} count Flush a specified number of requests.
9393
*/
9494
flush: function (count) {
95-
if (!responses.length) throw new Error('No pending DS requests to flush !');
95+
if (!responses.length) throw new Error('No pending DSHttpAdapter requests to flush !');
9696

9797
if (angular.isDefined(count)) {
9898
while (count--) {
99-
if (!responses.length) throw new Error('No more pending DS requests to flush !');
99+
if (!responses.length) throw new Error('No more pending DSHttpAdapter requests to flush !');
100100
responses.shift()();
101101
}
102102
} else {
@@ -534,11 +534,11 @@ function DSLocalStorageAdapterProvider() {
534534
* @param {number=} count Flush a specified number of requests.
535535
*/
536536
flush: function (count) {
537-
if (!responses.length) throw new Error('No pending DS requests to flush !');
537+
if (!responses.length) throw new Error('No pending DSLocalStorageAdapter requests to flush !');
538538

539539
if (angular.isDefined(count)) {
540540
while (count--) {
541-
if (!responses.length) throw new Error('No more pending DS requests to flush !');
541+
if (!responses.length) throw new Error('No more pending DSLocalStorageAdapter requests to flush !');
542542
responses.shift()();
543543
}
544544
} else {
@@ -573,7 +573,7 @@ function DSLocalStorageAdapterProvider() {
573573
*
574574
* DSLocalStorageAdapter.flush();
575575
*
576-
* assert.equal(DS.find.callCount, 1);
576+
* assert.equal(DSLocalStorageAdapter.find.callCount, 1);
577577
* ```
578578
*
579579
* @param {string} name The name of the function to respond to.
@@ -755,7 +755,11 @@ function DSProvider() {
755755
this.$get = ['DSMockUtils', 'DSUtils', 'DSErrors', function (DSMockUtils, DSUtils, DSErrors) {
756756

757757
var MockDSExpectation = DSMockUtils.MockDSExpectation;
758-
var defaults = {};
758+
var defaults = {
759+
deserialize: function (resourceName, data) {
760+
return data.data ? data.data : data;
761+
}
762+
};
759763

760764
angular.forEach(asyncMethods, function (name) {
761765
stubs[name] = DSMockUtils.mockAsync(name, 'DS', expectations, definitions, requests, responses);
@@ -1166,7 +1170,7 @@ module.exports = DSProvider;
11661170
* @description
11671171
* Fake angular-data implementation suitable for unit testing angular applications that use the `angular-data.DS` module.
11681172
*
1169-
* __Version:__ 0.5.1
1173+
* __Version:__ 0.5.2
11701174
*
11711175
* __angular-data-mocks requires SinonJS to be loaded in order to work.__
11721176
*
@@ -1232,9 +1236,8 @@ module.exports = DSProvider;
12321236
responses.push(createResponse(resourceName, deferred, expectation.response));
12331237
return deferred.promise;
12341238
} else {
1235-
throw new Error('No response defined for DSHttpAdapter.' + expectation.method);
1239+
throw new Error('No response defined for ' + namespace + '.' + expectation.method);
12361240
}
1237-
return;
12381241
}
12391242

12401243
// try to match request to any backend definitions
@@ -1248,12 +1251,11 @@ module.exports = DSProvider;
12481251
} else {
12491252
throw new Error('No response defined !');
12501253
}
1251-
return;
12521254
}
12531255
}
12541256

12551257
// Any requests that made it this far aren't being handled, so throw an exception
1256-
throw new Error('Unexpected request: DSHttpAdapter.' + name + ' ' + resourceName + '\n' +
1258+
throw new Error('Unexpected request: ' + namespace + '.' + name + ' ' + resourceName + '\n' +
12571259
'No more requests expected');
12581260
};
12591261
}
@@ -1353,7 +1355,7 @@ module.exports = DSProvider;
13531355
'angular-data.DSHttpAdapterMock',
13541356
'angular-data.DSLocalStorageAdapterMock'
13551357
])
1356-
.value('version', '0.5.1');
1358+
.value('version', '0.5.2');
13571359

13581360
})(window, window.angular);
13591361

dist/angular-data-mocks.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-data-mocks",
33
"description": "A mock of angular-data for testing purposes.",
4-
"version": "0.5.1",
4+
"version": "0.5.2",
55
"homepage": "https://github.com/jmdobry/angular-data-mocks",
66
"repository": {
77
"type": "git",

0 commit comments

Comments
 (0)