summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorDaniel Schaal <daniel@schaal.email>2017-06-08 05:15:16 +0200
committerDaniel Schaal <daniel@schaal.email>2017-06-10 11:19:07 +0200
commit1fbb81e4697fa3dc272ebfc89d0aa906def05892 (patch)
treeed445f9bd0e4dfad863166df6db6c78e19946560 /js
parent7cebc63defdd640b822132a1e24b489345ac06e9 (diff)
Fix tests
Diffstat (limited to 'js')
-rw-r--r--js/tests/unit/controller/ContentControllerSpec.js37
-rw-r--r--js/tests/unit/controller/SettingsControllerSpec.js8
2 files changed, 17 insertions, 28 deletions
diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js
index dbee79f44..2e49e74db 100644
--- a/js/tests/unit/controller/ContentControllerSpec.js
+++ b/js/tests/unit/controller/ContentControllerSpec.js
@@ -361,18 +361,14 @@ describe('ContentController', function () {
ItemResource.autoPage = jasmine.createSpy('autoPage')
.and.callFake(function () {
return {
- success: function (callback) {
+ then: function (callback) {
callback({
- 'items': []
+ data: {'items': []}
});
return {
- error: function () {
- return {
- finally: function (callback) {
- callback();
- }
- };
+ finally: function (callback) {
+ callback();
}
};
}
@@ -431,17 +427,15 @@ describe('ContentController', function () {
ItemResource.autoPage = jasmine.createSpy('autoPage')
.and.callFake(function () {
return {
- success: function (callback) {
+ then: function (callback) {
callback({
- 'items': [{items: [{id: 3, fingerprint: 'a'}]}]
+ data: {
+ 'items': [
+ {items: [{id: 3, fingerprint: 'a'}]}]}
});
return {
- error: function () {
- return {
- finally: function () {
- }
- };
+ finally: function () {
}
};
}
@@ -490,18 +484,13 @@ describe('ContentController', function () {
ItemResource.autoPage = jasmine.createSpy('autoPage')
.and.callFake(function () {
return {
- success: function (callback) {
+ then: function (callback, errorCallback) {
callback({
- 'items': []
- });
+ data: {'items': []}
+ }, errorCallback({}));
return {
- error: function (callback) {
- callback();
- return {
- finally: function () {
- }
- };
+ finally: function () {
}
};
}
diff --git a/js/tests/unit/controller/SettingsControllerSpec.js b/js/tests/unit/controller/SettingsControllerSpec.js
index 63b74abae..280d86db4 100644
--- a/js/tests/unit/controller/SettingsControllerSpec.js
+++ b/js/tests/unit/controller/SettingsControllerSpec.js
@@ -62,12 +62,12 @@ describe('SettingsController', function () {
it('should import articles', inject(function ($controller, ItemResource,
Publisher) {
- var data = 1;
+ var response = {data: 1};
ItemResource.importArticles = jasmine.createSpy('importArticles')
.and.callFake(function () {
return {
- success: function (callback) {
- callback(data);
+ then: function (callback) {
+ callback(response.data);
return {
finally: function (finalCallback) {
finalCallback();
@@ -89,7 +89,7 @@ describe('SettingsController', function () {
expect(ItemResource.importArticles)
.toHaveBeenCalledWith(JSON.parse(content));
- expect(Publisher.publishAll).toHaveBeenCalledWith(data);
+ expect(Publisher.publishAll).toHaveBeenCalledWith(response.data);
expect(ctrl.isArticlesImporting).toBe(false);
expect(ctrl.articleImportError).toBe(false);
}));