Skip to content

Commit 171da5f

Browse files
author
guylabs
committed
Fix resources tests.
1 parent 322d648 commit 171da5f

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

test/angular-spring-data-rest-provider.resources.spec.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ describe("the resources property", function () {
191191
expect(function () {
192192
expectResourceExecution(processedData, resourcesKey,
193193
"expectedUrl", httpBackend, {'wrongPropertyName': 'value'});
194-
}).toThrow("The provided resource object must contain a name property.");
194+
}).toThrowError("The provided resource object must contain a name property.");
195195
});
196+
197+
this.rootScope.$apply();
196198
});
197199

198200
it("must not use any parameters if the resource object is a string and no parameters are given", function () {
@@ -207,6 +209,10 @@ describe("the resources property", function () {
207209
expectResourceExecution(processedData, resourcesKey,
208210
processedData[linksKey]["self"].href, httpBackend, "self")
209211
});
212+
213+
this.httpBackend.flush();
214+
this.httpBackend.verifyNoOutstandingRequest();
215+
this.httpBackend.verifyNoOutstandingExpectation();
210216
});
211217

212218
it("must use the given parameters if the resource object is a string", function () {
@@ -222,6 +228,10 @@ describe("the resources property", function () {
222228
processedData[linksKey]["self"].href + "?parameterName=parameterValue", httpBackend, "self",
223229
{'parameterName': 'parameterValue'});
224230
});
231+
232+
this.httpBackend.flush();
233+
this.httpBackend.verifyNoOutstandingRequest();
234+
this.httpBackend.verifyNoOutstandingExpectation();
225235
});
226236

227237
it("must use the resource name if the correct resource object is given", function () {
@@ -236,6 +246,10 @@ describe("the resources property", function () {
236246
expectResourceExecution(processedData, resourcesKey,
237247
processedData[linksKey]["self"].href, httpBackend, {'name': 'self'})
238248
});
249+
250+
this.httpBackend.flush();
251+
this.httpBackend.verifyNoOutstandingRequest();
252+
this.httpBackend.verifyNoOutstandingExpectation();
239253
});
240254

241255
it("must use the correct resource object name and the given parameters", function () {
@@ -251,6 +265,10 @@ describe("the resources property", function () {
251265
processedData[linksKey]["self"].href + "?parameterName=parameterValue",
252266
httpBackend, {'name': 'self'}, {'parameterName': 'parameterValue'})
253267
});
268+
269+
this.httpBackend.flush();
270+
this.httpBackend.verifyNoOutstandingRequest();
271+
this.httpBackend.verifyNoOutstandingExpectation();
254272
});
255273

256274
it("must use the correct resource object name and parameters", function () {
@@ -266,6 +284,10 @@ describe("the resources property", function () {
266284
processedData[linksKey]["self"].href + "?parameterName=parameterValue",
267285
httpBackend, {'name': 'self', 'parameters': {'parameterName': 'parameterValue'}})
268286
});
287+
288+
this.httpBackend.flush();
289+
this.httpBackend.verifyNoOutstandingRequest();
290+
this.httpBackend.verifyNoOutstandingExpectation();
269291
});
270292

271293
it("must use the correct resource object name and merge the resource object parameters with the given parameters", function () {
@@ -282,6 +304,10 @@ describe("the resources property", function () {
282304
httpBackend, {'name': 'self', 'parameters': {'objectParameterName': 'objectParameterValue'}},
283305
{'parameterName': 'parameterValue'})
284306
});
307+
308+
this.httpBackend.flush();
309+
this.httpBackend.verifyNoOutstandingRequest();
310+
this.httpBackend.verifyNoOutstandingExpectation();
285311
});
286312

287313
it("must return the resources of the object", function () {

test/angular-spring-data-rest.helper.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ var expectResourceExecution = function (data, resourcesKey, expectedUrl, httpBac
5959

6060
// call the resource method
6161
data[resourcesKey](resourceName, parameters).get();
62-
httpBackend.flush();
6362
};
6463

6564
var mockData = function () {

0 commit comments

Comments
 (0)