diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-15 16:02:32 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-15 16:02:32 +0200 |
commit | 464ff6c4c1bda3edbd0f132c4d3d866539d3a117 (patch) | |
tree | 96b8fd57e24ebaab762a190a933cd98e1c7a4881 /js/tests | |
parent | 89c31ab5fcb2f931fecc5ce82608ff7c8129510a (diff) |
renamed bl to businesslayer, handle exception in update routine, fix #69
Diffstat (limited to 'js/tests')
-rw-r--r-- | js/tests/controllers/feedcontrollerSpec.coffee | 24 | ||||
-rw-r--r-- | js/tests/controllers/itemcontrollerSpec.coffee | 10 | ||||
-rw-r--r-- | js/tests/controllers/settingscontrollerSpec.coffee | 3 | ||||
-rw-r--r-- | js/tests/services/businesslayer/businesslayerSpec.coffee (renamed from js/tests/services/bl/blSpec.coffee) | 23 | ||||
-rw-r--r-- | js/tests/services/businesslayer/feedbusinesslayerSpec.coffee (renamed from js/tests/services/bl/feedblSpec.coffee) | 74 | ||||
-rw-r--r-- | js/tests/services/businesslayer/folderbusinesslayerSpec.coffee (renamed from js/tests/services/bl/folderblSpec.coffee) | 66 | ||||
-rw-r--r-- | js/tests/services/businesslayer/itembusinesslayerSpec.coffee (renamed from js/tests/services/bl/itemblSpec.coffee) | 56 | ||||
-rw-r--r-- | js/tests/services/businesslayer/starredbusinesslayerSpec.coffee (renamed from js/tests/services/bl/starredblSpec.coffee) | 17 | ||||
-rw-r--r-- | js/tests/services/businesslayer/subsriptionsbusinesslayerSpec.coffee (renamed from js/tests/services/bl/subscriptionsblSpec.coffee) | 22 |
9 files changed, 150 insertions, 145 deletions
diff --git a/js/tests/controllers/feedcontrollerSpec.coffee b/js/tests/controllers/feedcontrollerSpec.coffee index e3ecb357b..f28319bdf 100644 --- a/js/tests/controllers/feedcontrollerSpec.coffee +++ b/js/tests/controllers/feedcontrollerSpec.coffee @@ -21,7 +21,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -describe '_FeedController', -> +describe 'FeedController', -> beforeEach module 'News' @@ -30,8 +30,9 @@ describe '_FeedController', -> @persistence = {} - beforeEach inject ($controller, @FolderBl, @FeedBl, $rootScope, - @unreadCountFormatter, @SubscriptionsBl, @StarredBl) => + beforeEach inject ($controller, @FolderBusinessLayer, @FeedBusinessLayer, + $rootScope, @unreadCountFormatter, + @SubscriptionsBusinessLayer, @StarredBusinessLayer) => @scope = $rootScope.$new() replace = $scope: @scope @@ -53,19 +54,20 @@ describe '_FeedController', -> expect(@scope.unreadCountFormatter).toBe(@unreadCountFormatter) - it 'should make FeedBl available', => - expect(@scope.feedBl).toBe(@FeedBl) + it 'should make FeedBusinessLayer available', => + expect(@scope.feedBusinessLayer).toBe(@FeedBusinessLayer) - it 'should make FolderBl available', => - expect(@scope.folderBl).toBe(@FolderBl) + it 'should make FolderBusinessLayer available', => + expect(@scope.folderBusinessLayer).toBe(@FolderBusinessLayer) - it 'should make SubscriptionsBl available', => - expect(@scope.subscriptionsBl).toBe(@SubscriptionsBl) + it 'should make SubscriptionsBusinessLayer available', => + expect(@scope.subscriptionsBusinessLayer).toBe( + @SubscriptionsBusinessLayer) - it 'should make StarredBl available', => - expect(@scope.starredBl).toBe(@StarredBl) + it 'should make StarredBusinessLayer available', => + expect(@scope.starredBusinessLayer).toBe(@StarredBusinessLayer) it 'should not add folders that have no name', => @persistence.createFolder = jasmine.createSpy('create') diff --git a/js/tests/controllers/itemcontrollerSpec.coffee b/js/tests/controllers/itemcontrollerSpec.coffee index d6a33b68e..c4827a9e8 100644 --- a/js/tests/controllers/itemcontrollerSpec.coffee +++ b/js/tests/controllers/itemcontrollerSpec.coffee @@ -26,7 +26,7 @@ describe 'ItemController', -> beforeEach module 'News' - beforeEach inject ($controller, @ItemBl, @FeedBl) => + beforeEach inject ($controller, @ItemBusinessLayer, @FeedBusinessLayer) => @scope = {} @persistence = { getItems: -> @@ -38,12 +38,12 @@ describe 'ItemController', -> @controller = $controller('ItemController', replace) - it 'should make ItemBl availabe', => - expect(@scope.itemBl).toBe(@ItemBl) + it 'should make ItemBusinessLayer availabe', => + expect(@scope.itemBusinessLayer).toBe(@ItemBusinessLayer) - it 'should make FeedBl availabe', => - expect(@scope.feedBl).toBe(@FeedBl) + it 'should make FeedBusinessLayer availabe', => + expect(@scope.feedBusinessLayer).toBe(@FeedBusinessLayer) it 'should ' diff --git a/js/tests/controllers/settingscontrollerSpec.coffee b/js/tests/controllers/settingscontrollerSpec.coffee index baedbadaf..ded9232e2 100644 --- a/js/tests/controllers/settingscontrollerSpec.coffee +++ b/js/tests/controllers/settingscontrollerSpec.coffee @@ -25,7 +25,8 @@ describe 'SettingsController', -> beforeEach module 'News' - beforeEach inject ($controller, @FeedBl, @FolderBl, @ShowAll) => + beforeEach inject ($controller, @FeedBusinessLayer, @FolderBusinessLayer, + @ShowAll) => @scope = {} @replace = '$scope': @scope diff --git a/js/tests/services/bl/blSpec.coffee b/js/tests/services/businesslayer/businesslayerSpec.coffee index 6da4724ec..d91124a89 100644 --- a/js/tests/services/bl/blSpec.coffee +++ b/js/tests/services/businesslayer/businesslayerSpec.coffee @@ -21,11 +21,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -describe 'Bl', -> +describe 'BusinessLayer', -> beforeEach module 'News' - beforeEach inject (@_Bl, @ActiveFeed, @FeedType, @ItemModel) => + beforeEach inject (@_BusinessLayer, @ActiveFeed, @FeedType, @ItemModel) => type = @FeedType.Starred angular.module('News').factory 'Persistence', => @getItemsSpy = jasmine.createSpy('getItems') @@ -33,26 +33,27 @@ describe 'Bl', -> getItems: @getItemsSpy } - class TestBl extends @_Bl + class TestBusinessLayer extends @_BusinessLayer constructor: (activeFeed, persistence, itemModel) -> super(activeFeed, persistence, itemModel, type) - @bl = new TestBl(@ActiveFeed, @persistence, @ItemModel) + @BusinessLayer = new TestBusinessLayer(@ActiveFeed, @persistence, + @ItemModel) it 'should reset the item cache when a different feed is being loaded', => @ItemModel.clear = jasmine.createSpy('clear') @ActiveFeed.handle({id: 0, type: @FeedType.Starred}) - @bl.load(0) + @BusinessLayer.load(0) expect(@ItemModel.clear).not.toHaveBeenCalled() - @bl.load(2) + @BusinessLayer.load(2) expect(@ItemModel.clear).toHaveBeenCalled() @ActiveFeed.handle({id: 2, type: @FeedType.Feed}) - @bl.load(2) + @BusinessLayer.load(2) expect(@ItemModel.clear).toHaveBeenCalled() @@ -64,7 +65,7 @@ describe 'Bl', -> @ItemModel.add({id: 6, lastModified: 44}) @persistence.getItems = jasmine.createSpy('latest') @ActiveFeed.handle({id: 3, type: @FeedType.Starred}) - @bl.load(3) + @BusinessLayer.load(3) expect(@persistence.getItems).toHaveBeenCalledWith(@FeedType.Starred, 3, 0, null, 6) @@ -73,14 +74,14 @@ describe 'Bl', -> it 'should send a get all items query when feed changed', => @persistence.getItems = jasmine.createSpy('latest') @ActiveFeed.handle({id: 3, type: @FeedType.Feed}) - @bl.load(3) + @BusinessLayer.load(3) expect(@persistence.getItems).toHaveBeenCalledWith(@FeedType.Starred, 3, 0) it 'should be active when its selected', => - expect(@bl.isActive(0)).toBe(false) + expect(@BusinessLayer.isActive(0)).toBe(false) @ActiveFeed.handle({type: @FeedType.Starred, id:0}) - expect(@bl.isActive(0)).toBe(true)
\ No newline at end of file + expect(@BusinessLayer.isActive(0)).toBe(true)
\ No newline at end of file diff --git a/js/tests/services/bl/feedblSpec.coffee b/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee index 0c538e2e3..bcb4476cf 100644 --- a/js/tests/services/bl/feedblSpec.coffee +++ b/js/tests/services/businesslayer/feedbusinesslayerSpec.coffee @@ -21,7 +21,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -describe 'FeedBl', -> +describe 'FeedBusinessLayer', -> beforeEach module 'News' @@ -41,7 +41,7 @@ describe 'FeedBl', -> } - beforeEach inject (@FeedBl, @FeedModel, @ItemModel, @FeedType, + beforeEach inject (@FeedBusinessLayer, @FeedModel, @ItemModel, @FeedType, @ShowAll, @ActiveFeed, @_ExistsError) => @ShowAll.setShowAll(false) @ActiveFeed.handle({type: @FeedType.Folder, id:0}) @@ -49,7 +49,7 @@ describe 'FeedBl', -> it 'should delete feeds', => @FeedModel.removeById = jasmine.createSpy('remove') @persistence.deleteFeed = jasmine.createSpy('deletequery') - @FeedBl.delete(3) + @FeedBusinessLayer.delete(3) expect(@FeedModel.removeById).toHaveBeenCalledWith(3) expect(@persistence.deleteFeed).toHaveBeenCalledWith(3) @@ -57,7 +57,7 @@ describe 'FeedBl', -> it 'should return the number of unread feeds', => @FeedModel.add({id: 3, unreadCount:134, urlHash: 'a1'}) - count = @FeedBl.getUnreadCount(3) + count = @FeedBusinessLayer.getUnreadCount(3) expect(count).toBe(134) @@ -70,7 +70,7 @@ describe 'FeedBl', -> @FeedModel.add(feed2) @FeedModel.add(feed3) - feeds = @FeedBl.getFeedsOfFolder(3) + feeds = @FeedBusinessLayer.getFeedsOfFolder(3) expect(feeds).toContain(feed1) expect(feeds).toContain(feed3) @@ -81,7 +81,7 @@ describe 'FeedBl', -> @FeedModel.add({id: 5, unreadCount:2, folderId: 2, urlHash: 'a2'}) @FeedModel.add({id: 1, unreadCount:12, folderId: 5, urlHash: 'a3'}) @FeedModel.add({id: 2, unreadCount:35, folderId: 3, urlHash: 'a4'}) - count = @FeedBl.getFolderUnreadCount(3) + count = @FeedBusinessLayer.getFolderUnreadCount(3) expect(count).toBe(169) @@ -92,7 +92,7 @@ describe 'FeedBl', -> @ItemModel.add({id: 6, feedId: 5, guidHash: 'a1'}) @ItemModel.add({id: 3, feedId: 5, guidHash: 'a2'}) @ItemModel.add({id: 2, feedId: 5, guidHash: 'a3'}) - @FeedBl.markFeedRead(5) + @FeedBusinessLayer.markFeedRead(5) expect(@persistence.setFeedRead).toHaveBeenCalledWith(5, 6) expect(@FeedModel.getById(5).unreadCount).toBe(0) @@ -107,7 +107,7 @@ describe 'FeedBl', -> @FeedModel.add({id: 5, unreadCount:2, folderId: 2, urlHash: 'a2'}) @FeedModel.add({id: 1, unreadCount:12, folderId: 3, urlHash: 'a3'}) - @FeedBl.markAllRead() + @FeedBusinessLayer.markAllRead() expect(@FeedModel.getById(3).unreadCount).toBe(0) expect(@FeedModel.getById(1).unreadCount).toBe(0) @@ -117,7 +117,7 @@ describe 'FeedBl', -> it 'should get the correct unread count for subscribtions', => @FeedModel.add({id: 3, unreadCount:134, urlHash: 'a1'}) @FeedModel.add({id: 5, unreadCount:2, urlHash: 'a2'}) - count = @FeedBl.getAllUnreadCount() + count = @FeedBusinessLayer.getAllUnreadCount() expect(count).toBe(136) @@ -125,32 +125,32 @@ describe 'FeedBl', -> it 'should return the correct number of feeds', => @FeedModel.add({id: 3, unreadCount:134, urlHash: 'a1'}) @FeedModel.add({id: 5, unreadCount:2, urlHash: 'a2'}) - count = @FeedBl.getNumberOfFeeds() + count = @FeedBusinessLayer.getNumberOfFeeds() expect(count).toBe(2) it 'should be visible if its active', => @ActiveFeed.handle({type: @FeedType.Feed, id:3}) - expect(@FeedBl.isVisible(3)).toBe(true) + expect(@FeedBusinessLayer.isVisible(3)).toBe(true) it 'should be visible if show all is true', => - expect(@FeedBl.isVisible(3)).toBe(false) + expect(@FeedBusinessLayer.isVisible(3)).toBe(false) @ShowAll.setShowAll(true) - expect(@FeedBl.isVisible(3)).toBe(true) + expect(@FeedBusinessLayer.isVisible(3)).toBe(true) it 'should be visible if unreadcount bigger than 0', => @FeedModel.add({id: 2, unreadCount:134, urlHash: 'a1'}) - expect(@FeedBl.isVisible(2)).toBe(true) + expect(@FeedBusinessLayer.isVisible(2)).toBe(true) it 'should not move the feed to a new folder', => @persistence.moveFeed = jasmine.createSpy('Move feed') @FeedModel.add({id: 2, unreadCount:134, urlHash: 'a1', folderId: 3}) - @FeedBl.move(2, 4) + @FeedBusinessLayer.move(2, 4) expect(@persistence.moveFeed).toHaveBeenCalledWith(2, 4) expect(@FeedModel.getById(2).folderId).toBe(4) @@ -159,14 +159,14 @@ describe 'FeedBl', -> it 'should not move the feed to the same folder', => @persistence.moveFeed = jasmine.createSpy('Move feed') @FeedModel.add({id: 2, unreadCount:134, urlHash: 'a1', folderId: 3}) - @FeedBl.move(2, 3) + @FeedBusinessLayer.move(2, 3) expect(@persistence.moveFeed).not.toHaveBeenCalled() it 'should set the show all setting', => @persistence.userSettingsReadShow = jasmine.createSpy('Show All') - @FeedBl.setShowAll(true) + @FeedBusinessLayer.setShowAll(true) expect(@persistence.userSettingsReadShow).toHaveBeenCalled() @@ -174,7 +174,7 @@ describe 'FeedBl', -> it 'should set the hide read setting', => @persistence.userSettingsReadHide = jasmine.createSpy('Hide Read') - @FeedBl.setShowAll(false) + @FeedBusinessLayer.setShowAll(false) expect(@persistence.userSettingsReadHide).toHaveBeenCalled() @@ -185,16 +185,16 @@ describe 'FeedBl', -> @FeedModel.add(item1) @FeedModel.add(item2) - expect(@FeedBl.getAll()).toContain(item1) - expect(@FeedBl.getAll()).toContain(item2) + expect(@FeedBusinessLayer.getAll()).toContain(item1) + expect(@FeedBusinessLayer.getAll()).toContain(item2) it 'should return if ShowAll is set', => @persistence.userSettingsReadShow = jasmine.createSpy('Show All') - expect(@FeedBl.isShowAll()).toBe(false) - @FeedBl.setShowAll(true) + expect(@FeedBusinessLayer.isShowAll()).toBe(false) + @FeedBusinessLayer.setShowAll(true) - expect(@FeedBl.isShowAll()).toBe(true) + expect(@FeedBusinessLayer.isShowAll()).toBe(true) it 'should return all feeds of a folder', => @@ -205,7 +205,7 @@ describe 'FeedBl', -> @FeedModel.add(item2) @FeedModel.add(item3) - folders = @FeedBl.getFeedsOfFolder(3) + folders = @FeedBusinessLayer.getFeedsOfFolder(3) expect(folders).toContain(item1) expect(folders).toContain(item3) @@ -220,7 +220,7 @@ describe 'FeedBl', -> link: 'test.com' @FeedModel.add(item2) - expect(@FeedBl.getFeedLink(4)).toBe('test.com') + expect(@FeedBusinessLayer.getFeedLink(4)).toBe('test.com') @@ -229,28 +229,28 @@ describe 'FeedBl', -> @FeedModel.add(item1) expect => - @FeedBl.create('john') + @FeedBusinessLayer.create('john') .toThrow(new @_ExistsError()) expect => - @FeedBl.create('johns') + @FeedBusinessLayer.create('johns') .not.toThrow(new @_ExistsError()) it 'should not create feeds that are empty', => expect => - @FeedBl.create(' ') + @FeedBusinessLayer.create(' ') .toThrow(new Error()) it 'should create a feed before theres a response from the server', => - @FeedBl.create('johns') + @FeedBusinessLayer.create('johns') expect(@FeedModel.size()).toBe(1) it 'should set a title and an url hash to the newly crated feed', => url = 'www.google.de' - @FeedBl.create(url) + @FeedBusinessLayer.create(url) hash = hex_md5(url) feed = @FeedModel.getByUrlHash(hash) @@ -272,7 +272,7 @@ describe 'FeedBl', -> ] for url in urls @FeedModel.clear() - @FeedBl.create(url) + @FeedBusinessLayer.create(url) hash = hex_md5(url) feed = @FeedModel.getByUrlHash(hash) expect(feed.title).toBe('google.de') @@ -281,7 +281,7 @@ describe 'FeedBl', -> it 'should make a create feed request', => @persistence.createFeed = jasmine.createSpy('add feed') - @FeedBl.create(' johns ') + @FeedBusinessLayer.create(' johns ') expect(@persistence.createFeed).toHaveBeenCalledWith('johns', 0, jasmine.any(Function)) @@ -295,7 +295,7 @@ describe 'FeedBl', -> data: 'hi' success(@response) - @FeedBl.create(' johns ', 0, onSuccess) + @FeedBusinessLayer.create(' johns ', 0, onSuccess) expect(onSuccess).toHaveBeenCalledWith(@response.data) @@ -310,7 +310,7 @@ describe 'FeedBl', -> msg: 'this is an error' success(@response) - @FeedBl.create(' johns ', 0, onSuccess, onFailure) + @FeedBusinessLayer.create(' johns ', 0, onSuccess, onFailure) expect(onSuccess).not.toHaveBeenCalled() expect(onFailure).toHaveBeenCalled() @@ -322,7 +322,7 @@ describe 'FeedBl', -> it 'should mark a feed error as read by removing it', => @FeedModel.add({id: 3, urlHash: 'john'}) - @FeedBl.markErrorRead('john') + @FeedBusinessLayer.markErrorRead('john') expect(@FeedModel.size()).toBe(0) expect(@FeedModel.getByUrlHash('john')).toBe(undefined) @@ -332,7 +332,7 @@ describe 'FeedBl', -> @persistence.updateFeed = jasmine.createSpy('update') @FeedModel.add({id: 3, urlHash: 'john'}) - @FeedBl.updateFeeds() + @FeedBusinessLayer.updateFeeds() expect(@persistence.updateFeed).toHaveBeenCalledWith(3) @@ -341,6 +341,6 @@ describe 'FeedBl', -> @persistence.updateFeed = jasmine.createSpy('update') @FeedModel.add({urlHash: 'john'}) - @FeedBl.updateFeeds() + @FeedBusinessLayer.updateFeeds() expect(@persistence.updateFeed).not.toHaveBeenCalled()
\ No newline at end of file diff --git a/js/tests/services/bl/folderblSpec.coffee b/js/tests/services/businesslayer/folderbusinesslayerSpec.coffee index 49f68634f..8c0264188 100644 --- a/js/tests/services/bl/folderblSpec.coffee +++ b/js/tests/services/businesslayer/folderbusinesslayerSpec.coffee @@ -21,7 +21,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -describe 'FolderBl', -> +describe 'FolderBusinessLayer', -> beforeEach module 'News' @@ -32,7 +32,7 @@ describe 'FolderBl', -> createFeed: -> openFolder: -> - beforeEach inject (@FolderBl, @FolderModel, @FeedModel, @ShowAll, + beforeEach inject (@FolderBusinessLayer, @FolderModel, @FeedModel, @ShowAll, @ActiveFeed, @FeedType, @_ExistsError) => @ShowAll.setShowAll(false) @ActiveFeed.handle({type: @FeedType.Feed, id:0}) @@ -42,7 +42,7 @@ describe 'FolderBl', -> it 'should delete folders', => @FolderModel.removeById = jasmine.createSpy('remove') @persistence.deleteFolder = jasmine.createSpy('deletequery') - @FolderBl.delete(3) + @FolderBusinessLayer.delete(3) expect(@FolderModel.removeById).toHaveBeenCalledWith(3) expect(@persistence.deleteFolder).toHaveBeenCalledWith(3) @@ -50,10 +50,10 @@ describe 'FolderBl', -> it 'should return true when folder has feeds', => @FeedModel.add({id: 5, unreadCount:2, folderId: 2, urlHash: 'a1'}) - expect(@FolderBl.hasFeeds(3)).toBeFalsy() + expect(@FolderBusinessLayer.hasFeeds(3)).toBeFalsy() @FeedModel.add({id: 2, unreadCount:35, folderId: 3, urlHash: 'a2'}) - expect(@FolderBl.hasFeeds(3)).toBeTruthy() + expect(@FolderBusinessLayer.hasFeeds(3)).toBeTruthy() it 'should toggle folder', => @@ -61,14 +61,14 @@ describe 'FolderBl', -> @persistence.collapseFolder = jasmine.createSpy('collapse') @FolderModel.add({id: 3, opened: false, name: 'ho'}) - @FolderBl.toggleFolder(4) + @FolderBusinessLayer.toggleFolder(4) expect(@FolderModel.getById(3).opened).toBeFalsy() - @FolderBl.toggleFolder(3) + @FolderBusinessLayer.toggleFolder(3) expect(@FolderModel.getById(3).opened).toBeTruthy() expect(@persistence.openFolder).toHaveBeenCalledWith(3) - @FolderBl.toggleFolder(3) + @FolderBusinessLayer.toggleFolder(3) expect(@FolderModel.getById(3).opened).toBeFalsy() expect(@persistence.collapseFolder).toHaveBeenCalledWith(3) @@ -79,7 +79,7 @@ describe 'FolderBl', -> @FeedModel.add({id: 5, unreadCount:2, folderId: 2, urlHash: 'a2'}) @FeedModel.add({id: 1, unreadCount:12, folderId: 3, urlHash: 'a3'}) - @FolderBl.markFolderRead(3) + @FolderBusinessLayer.markFolderRead(3) expect(@FeedModel.getById(3).unreadCount).toBe(0) expect(@FeedModel.getById(1).unreadCount).toBe(0) @@ -91,19 +91,19 @@ describe 'FolderBl', -> @FeedModel.add({id: 6, unreadCount:3, folderId: 3, urlHash: 'a2'}) @FeedModel.add({id: 7, unreadCount:4, folderId: 2, urlHash: 'a3'}) - expect(@FolderBl.getUnreadCount(2)).toBe(6) + expect(@FolderBusinessLayer.getUnreadCount(2)).toBe(6) it 'should be visible if show all is true', => - expect(@FolderBl.isVisible(3)).toBe(false) + expect(@FolderBusinessLayer.isVisible(3)).toBe(false) @ShowAll.setShowAll(true) - expect(@FolderBl.isVisible(3)).toBe(true) + expect(@FolderBusinessLayer.isVisible(3)).toBe(true) it 'should be visible if its active', => @ActiveFeed.handle({type: @FeedType.Folder, id:3}) - expect(@FolderBl.isVisible(3)).toBe(true) + expect(@FolderBusinessLayer.isVisible(3)).toBe(true) it 'should be visible if one of its subfeeds is active', => @@ -112,7 +112,7 @@ describe 'FolderBl', -> @FeedModel.add({id: 7, unreadCount:0, folderId: 2, urlHash: 'a3'}) @ActiveFeed.handle({type: @FeedType.Feed, id:6}) - expect(@FolderBl.isVisible(3)).toBe(true) + expect(@FolderBusinessLayer.isVisible(3)).toBe(true) it 'should be visible if showAll is false and it has unread items', => @@ -121,7 +121,7 @@ describe 'FolderBl', -> @FeedModel.add({id: 7, unreadCount:4, folderId: 2, urlHash: 'a3'}) @ActiveFeed.handle({type: @FeedType.Folder, id:2}) - expect(@FolderBl.isVisible(3)).toBe(true) + expect(@FolderBusinessLayer.isVisible(3)).toBe(true) it 'should return all folders', => @@ -130,8 +130,8 @@ describe 'FolderBl', -> @FolderModel.add(item1) @FolderModel.add(item2) - expect(@FolderBl.getAll()).toContain(item1) - expect(@FolderBl.getAll()).toContain(item2) + expect(@FolderBusinessLayer.getAll()).toContain(item1) + expect(@FolderBusinessLayer.getAll()).toContain(item2) it 'should not create a folder if it already exists', => @@ -139,22 +139,22 @@ describe 'FolderBl', -> @FolderModel.add(item1) expect => - @FolderBl.create('john') + @FolderBusinessLayer.create('john') .toThrow(new @_ExistsError()) expect => - @FolderBl.create('johns') + @FolderBusinessLayer.create('johns') .not.toThrow(new @_ExistsError()) it 'should not create folders that are empty', => expect => - @FolderBl.create(' ') + @FolderBusinessLayer.create(' ') .toThrow(new Error()) it 'should create a folder before theres a response from the server', => - @FolderBl.create('johns') + @FolderBusinessLayer.create('johns') expect(@FolderModel.size()).toBe(1) expect(@FolderModel.getByName('johns').opened).toBe(true) @@ -162,7 +162,7 @@ describe 'FolderBl', -> it 'should make a create folder request', => @persistence.createFolder = jasmine.createSpy('add folder') - @FolderBl.create(' johns ') + @FolderBusinessLayer.create(' johns ') expect(@persistence.createFolder).toHaveBeenCalledWith('johns', 0, jasmine.any(Function)) @@ -176,7 +176,7 @@ describe 'FolderBl', -> data: 'jooo' success(@response) - @FolderBl.create(' johns ', onSuccess) + @FolderBusinessLayer.create(' johns ', onSuccess) expect(onSuccess).toHaveBeenCalledWith(@response.data) @@ -191,7 +191,7 @@ describe 'FolderBl', -> msg: 'this is an error' success(@response) - @FolderBl.create(' johns ', onSuccess, onFailure) + @FolderBusinessLayer.create(' johns ', onSuccess, onFailure) expect(onSuccess).not.toHaveBeenCalled() expect(onFailure).toHaveBeenCalled() @@ -202,7 +202,7 @@ describe 'FolderBl', -> it 'should mark a folder error as read by removing it', => @FolderModel.add({id: 3, name: 'john'}) - @FolderBl.markErrorRead('John') + @FolderBusinessLayer.markErrorRead('John') expect(@FolderModel.size()).toBe(0) expect(@FolderModel.getByName('john')).toBe(undefined) @@ -212,14 +212,14 @@ describe 'FolderBl', -> item = {id: 3, name: 'john'} @FolderModel.add(item) - expect(@FolderBl.getById(3)).toBe(item) + expect(@FolderBusinessLayer.getById(3)).toBe(item) it 'should open a folder', => @persistence.openFolder = jasmine.createSpy('open') @FolderModel.add({id: 3, opened: false, name: 'ho'}) - @FolderBl.open(3) + @FolderBusinessLayer.open(3) expect(@FolderModel.getById(3).opened).toBeTruthy() expect(@persistence.openFolder).toHaveBeenCalledWith(3) @@ -247,7 +247,7 @@ describe 'FolderBl', -> </body> </opml>' - @FolderBl.import(xml) + @FolderBusinessLayer.import(xml) expect(@persistence.createFolder).not.toHaveBeenCalled() expect(@persistence.createFeed).not.toHaveBeenCalled() @@ -277,7 +277,7 @@ describe 'FolderBl', -> </body> </opml>' - @FolderBl.import(xml) + @FolderBusinessLayer.import(xml) expect(@persistence.createFolder).toHaveBeenCalledWith('test', 0, jasmine.any(Function)) @@ -311,7 +311,7 @@ describe 'FolderBl', -> </body> </opml>' - @FolderBl.import(xml) + @FolderBusinessLayer.import(xml) expect(@persistence.createFolder).not.toHaveBeenCalled() expect(@persistence.createFeed).toHaveBeenCalledWith( @@ -355,7 +355,7 @@ describe 'FolderBl', -> </body> </opml>' - @FolderBl.import(xml) + @FolderBusinessLayer.import(xml) expect(@persistence.createFolder).toHaveBeenCalledWith('Design', 0, jasmine.any(Function)) @@ -395,7 +395,7 @@ describe 'FolderBl', -> </body> </opml>' - @FolderBl.import(xml) + @FolderBusinessLayer.import(xml) expect(@persistence.createFolder).not.toHaveBeenCalled() expect(@persistence.createFeed).toHaveBeenCalledWith( @@ -434,7 +434,7 @@ describe 'FolderBl', -> </body> </opml>' - @FolderBl.import(xml) + @FolderBusinessLayer.import(xml) expect(@persistence.createFolder).not.toHaveBeenCalled() expect(@persistence.createFeed).not.toHaveBeenCalled()
\ No newline at end of file diff --git a/js/tests/services/bl/itemblSpec.coffee b/js/tests/services/businesslayer/itembusinesslayerSpec.coffee index 4c2a5d660..932260747 100644 --- a/js/tests/services/bl/itemblSpec.coffee +++ b/js/tests/services/businesslayer/itembusinesslayerSpec.coffee @@ -21,7 +21,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ### -describe 'ItemBl', -> +describe 'ItemBusinessLayer', -> beforeEach module 'News' @@ -30,8 +30,8 @@ describe 'ItemBl', -> angular.module('News').factory 'Persistence', => @persistence = {} - beforeEach inject (@ItemModel, @ItemBl, @StatusFlag, @ActiveFeed - @FeedType, @FeedModel, @StarredBl) => + beforeEach inject (@ItemModel, @ItemBusinessLayer, @StatusFlag, @ActiveFeed + @FeedType, @FeedModel, @StarredBusinessLayer) => @item1 = {id: 5, title: 'hi', unreadCount:134, urlHash: 'a3', folderId: 3} @FeedModel.add(@item1) @@ -45,7 +45,7 @@ describe 'ItemBl', -> @ItemModel.add(item2) @ItemModel.add(item3) - items = @ItemBl.getAll() + items = @ItemBusinessLayer.getAll() expect(items).toContain(item1) expect(items).toContain(item2) @@ -54,26 +54,26 @@ describe 'ItemBl', -> it 'should tell if no feed is active', => @ActiveFeed.handle({type: @FeedType.Folder, id: 0}) - expect(@ItemBl.noFeedActive()).toBe(true) + expect(@ItemBusinessLayer.noFeedActive()).toBe(true) @ActiveFeed.handle({type: @FeedType.Subscriptions, id: 0}) - expect(@ItemBl.noFeedActive()).toBe(true) + expect(@ItemBusinessLayer.noFeedActive()).toBe(true) @ActiveFeed.handle({type: @FeedType.Starred, id: 0}) - expect(@ItemBl.noFeedActive()).toBe(true) + expect(@ItemBusinessLayer.noFeedActive()).toBe(true) @ActiveFeed.handle({type: @FeedType.Shared, id: 0}) - expect(@ItemBl.noFeedActive()).toBe(true) + expect(@ItemBusinessLayer.noFeedActive()).toBe(true) @ActiveFeed.handle({type: @FeedType.Feed, id: 0}) - expect(@ItemBl.noFeedActive()).toBe(false) + expect(@ItemBusinessLayer.noFeedActive()).toBe(false) it 'should return the correct feed title', => item2 = {id: 2, feedId: 5, guidHash: 'a3'} @ItemModel.add(item2) - expect(@ItemBl.getFeedTitle(2)).toBe('hi') + expect(@ItemBusinessLayer.getFeedTitle(2)).toBe('hi') it 'should set an item unstarred', => @@ -83,10 +83,10 @@ describe 'ItemBl', -> @ItemModel.add(item2) item2.setStarred() - @ItemBl.toggleStarred(2) + @ItemBusinessLayer.toggleStarred(2) expect(item2.isStarred()).toBe(false) - expect(@StarredBl.getUnreadCount()).toBe(-1) + expect(@StarredBusinessLayer.getUnreadCount()).toBe(-1) expect(@persistence.unstarItem).toHaveBeenCalledWith(5, 'a3') @@ -97,10 +97,10 @@ describe 'ItemBl', -> @ItemModel.add(item2) item2.setUnstarred() - @ItemBl.toggleStarred(2) + @ItemBusinessLayer.toggleStarred(2) expect(item2.isStarred()).toBe(true) - expect(@StarredBl.getUnreadCount()).toBe(1) + expect(@StarredBusinessLayer.getUnreadCount()).toBe(1) expect(@persistence.starItem).toHaveBeenCalledWith(5, 'a3') @@ -111,7 +111,7 @@ describe 'ItemBl', -> @ItemModel.add(item) |