Skip to content

Commit c1d8061

Browse files
committed
added test for when interceptor gets string response
1 parent 3b823e9 commit c1d8061

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ describe("if the spring data rest interceptor is added", function () {
8989
// start the injectors previously registered with calls to angular.mock.module and assign it to the
9090
// this scope. See above for the description.
9191
var httpBackendVar = undefined;
92-
inject(function (_SpringDataRestAdapter_, $httpBackend) {
92+
inject(function (_SpringDataRestAdapter_, $httpBackend, _$http_) {
9393
SpringDataRestAdapter = _SpringDataRestAdapter_;
9494
httpBackendVar = $httpBackend;
95+
$http = _$http_;
9596
});
9697
this.httpBackend = httpBackendVar;
9798

@@ -133,4 +134,18 @@ describe("if the spring data rest interceptor is added", function () {
133134
this.httpBackend.verifyNoOutstandingExpectation();
134135
});
135136

137+
it(" it must not execute when a response is of type string", function () {
138+
var linkHref = "http://localhost:8080/categories";
139+
var responseString = "<html>test</html>";
140+
this.httpBackend.whenGET(linkHref).respond(200, responseString);
141+
this.httpBackend.expectGET(linkHref);
142+
143+
var data = $http.get(linkHref).then(function(response){
144+
data = response.data;
145+
});
146+
147+
this.httpBackend.flush();
148+
expect(data).toBe(responseString);
149+
});
150+
136151
});

0 commit comments

Comments
 (0)