summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-18 11:49:26 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-18 11:49:26 +0100
commit8c5bf6f3173ce84c11cd1e0a77c30b71c3463d52 (patch)
tree77043acda22b45e6f0c1cd10a5246a30dbc6659c /js/tests
parent2eec5da48cb0ac1833a92ab73eb5bff68e7c84f7 (diff)
added rewritten js from appframwork-js branch
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/services/activefeedSpec.coffee52
-rw-r--r--js/tests/services/feedtypeSpec.coffee49
-rw-r--r--js/tests/services/models/feedmodelSpec.coffee46
-rw-r--r--js/tests/services/models/foldermodelSpec.coffee32
-rw-r--r--js/tests/services/models/itemmodelSpec.coffee32
-rw-r--r--js/tests/services/opmlparserSpec.coffee36
-rw-r--r--js/tests/services/persistenceSpec.coffee359
-rw-r--r--js/tests/services/showallSpec.coffee42
-rw-r--r--js/tests/services/starredcountSpec.coffee42
-rw-r--r--js/tests/stubs/modules.js23
10 files changed, 713 insertions, 0 deletions
diff --git a/js/tests/services/activefeedSpec.coffee b/js/tests/services/activefeedSpec.coffee
new file mode 100644
index 000000000..f8b3a17ea
--- /dev/null
+++ b/js/tests/services/activefeedSpec.coffee
@@ -0,0 +1,52 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+
+describe '_ActiveFeed', ->
+
+
+ beforeEach module 'News'
+
+ beforeEach inject (@_ActiveFeed, @FeedType) =>
+ @data =
+ id: 5
+ type: 3
+
+
+ it 'should be Subscriptions by default', =>
+ active = new @_ActiveFeed()
+
+ expect(active.getType()).toBe(@FeedType.Subscriptions)
+
+
+ it 'should set the correct feed id', =>
+ active = new @_ActiveFeed()
+ active.handle(@data)
+
+ expect(active.getId()).toBe(5)
+
+
+ it 'should set the correct feed type', =>
+ active = new @_ActiveFeed()
+ active.handle(@data)
+
+ expect(active.getType()).toBe(3) \ No newline at end of file
diff --git a/js/tests/services/feedtypeSpec.coffee b/js/tests/services/feedtypeSpec.coffee
new file mode 100644
index 000000000..4a5855b0c
--- /dev/null
+++ b/js/tests/services/feedtypeSpec.coffee
@@ -0,0 +1,49 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+
+describe 'FeedType', ->
+
+
+ beforeEach module 'News'
+
+ beforeEach inject (@FeedType) =>
+
+
+ it 'should have the correct folder number', =>
+ expect(@FeedType.Feed).toBe(0)
+
+
+ it 'should have the correct folder number', =>
+ expect(@FeedType.Folder).toBe(1)
+
+
+ it 'should have the correct folder number', =>
+ expect(@FeedType.Starred).toBe(2)
+
+
+ it 'should have the correct folder number', =>
+ expect(@FeedType.Subscriptions).toBe(3)
+
+
+ it 'should have the correct folder number', =>
+ expect(@FeedType.Shared).toBe(4 )
diff --git a/js/tests/services/models/feedmodelSpec.coffee b/js/tests/services/models/feedmodelSpec.coffee
new file mode 100644
index 000000000..faa95d36a
--- /dev/null
+++ b/js/tests/services/models/feedmodelSpec.coffee
@@ -0,0 +1,46 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+
+describe '_FeedModel', ->
+
+
+ beforeEach module 'News'
+
+ beforeEach inject (@_FeedModel, @_Model) =>
+
+
+ it 'should extend model', =>
+ expect(new @_FeedModel instanceof @_Model).toBeTruthy()
+
+
+ it 'should bind an imagepath to the item if the url is empty', =>
+ item =
+ id: 3
+ icon: 'url()'
+ utils =
+ imagePath: jasmine.createSpy('utils')
+
+ model = new @_FeedModel(utils)
+ model.add(item)
+
+ expect(utils.imagePath).toHaveBeenCalledWith('news', 'rss.svg') \ No newline at end of file
diff --git a/js/tests/services/models/foldermodelSpec.coffee b/js/tests/services/models/foldermodelSpec.coffee
new file mode 100644
index 000000000..3cae0064c
--- /dev/null
+++ b/js/tests/services/models/foldermodelSpec.coffee
@@ -0,0 +1,32 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+describe '_FolderModel', ->
+
+
+ beforeEach module 'News'
+
+ beforeEach inject (@_FolderModel, @_Model) =>
+
+
+ it 'should extend model', =>
+ expect(new @_FolderModel instanceof @_Model).toBeTruthy() \ No newline at end of file
diff --git a/js/tests/services/models/itemmodelSpec.coffee b/js/tests/services/models/itemmodelSpec.coffee
new file mode 100644
index 000000000..061f84f01
--- /dev/null
+++ b/js/tests/services/models/itemmodelSpec.coffee
@@ -0,0 +1,32 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+describe '_ItemModel', ->
+
+
+ beforeEach module 'News'
+
+ beforeEach inject (@_ItemModel, @_Model) =>
+
+
+ it 'should extend model', =>
+ expect(new @_ItemModel instanceof @_Model).toBeTruthy() \ No newline at end of file
diff --git a/js/tests/services/opmlparserSpec.coffee b/js/tests/services/opmlparserSpec.coffee
new file mode 100644
index 000000000..ffdd383ff
--- /dev/null
+++ b/js/tests/services/opmlparserSpec.coffee
@@ -0,0 +1,36 @@
+###
+
+ownCloud - News
+
+@author Raghu Nayyar
+@copyright 2012 Raghu Nayyar me@iraghu.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+
+describe '_OPMLParser', ->
+
+ beforeEach module 'News'
+
+ beforeEach inject (@_OPMLParser) =>
+ @parser = new @_OPMLParser()
+
+ it 'should return only the root folder when parsing empty OPML', =>
+ @data = @parser.parseXML('')
+ expect(@data.getName()).toBe('root')
+
+
+ \ No newline at end of file
diff --git a/js/tests/services/persistenceSpec.coffee b/js/tests/services/persistenceSpec.coffee
new file mode 100644
index 000000000..8ae40ea40
--- /dev/null
+++ b/js/tests/services/persistenceSpec.coffee
@@ -0,0 +1,359 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+
+describe '_Persistence', ->
+
+
+ beforeEach module 'News'
+
+ beforeEach inject (@_Persistence, @$rootScope) =>
+ @req =
+ post: jasmine.createSpy('POST')
+ get: jasmine.createSpy('GET').andCallFake (url, p1, p2, callback) ->
+ if callback
+ callback()
+ @config =
+ itemBatchSize: 12
+ @active =
+ getType: -> 3
+ getId: -> 1
+ @loading =
+ increase: ->
+ decrease: ->
+
+
+ it 'should should show a loading sign when init', =>
+ loading =
+ increase: jasmine.createSpy('loading')
+ decrease: jasmine.createSpy('finished loading')
+
+ pers = new @_Persistence(@req, loading, @config, @active, @$rootScope)
+ pers.init()
+
+ expect(loading.increase).toHaveBeenCalled()
+ expect(loading.decrease).toHaveBeenCalled()
+
+
+ ###
+ FEED CONTROLLER
+ ###
+ it 'should get all feeds', =>
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.getAllFeeds()
+
+ expect(@req.get).toHaveBeenCalledWith('news_feeds', {}, {}, angular.noop)
+
+ it 'should get a feed by id', =>
+ url =
+ feedId: 1
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.getFeedById(url.feedId)
+
+ expect(@req.get).toHaveBeenCalledWith('news_feed', url)
+
+
+ it 'create a correct request for moving a feed', =>
+ data =
+ folderId: 4
+ url =
+ feedId: 3
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.moveFeed(url.feedId, data.folderId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_move_feed', url, data)
+
+
+ it 'shoud send a correct request for marking all items read', =>
+ data =
+ highestItemId: 4
+ url =
+ feedId: 3
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.setFeedRead(url.feedId, data.highestItemId)
+
+
+ expect(@req.post).toHaveBeenCalledWith('news_set_feed_read', url, data)
+
+
+ it 'send a correct feed update request', =>
+ url =
+ feedId: 3
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.updateFeed(url.feedId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_update_feed', url)
+
+
+ it 'send a correct get active feed request', =>
+ succs = angular.noop
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.getActiveFeed(succs)
+
+ expect(@req.get).toHaveBeenCalledWith('news_active_feed', {}, {}, succs)
+
+
+ it 'send a correct feed delete request', =>
+ url =
+ feedId: 3
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.deleteFeed(url.feedId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_delete_feed', url)
+
+
+ it 'send a correct feed create request', =>
+ data =
+ parentFolderId: 5
+ url: 'http://google.de'
+
+ onsuccess = angular.noop
+ onerror = angular.noop
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.createFeed(data.url, data.parentFolderId, onsuccess, onerror)
+
+ expect(@req.post).toHaveBeenCalledWith('news_create_feed', {}, data,
+ onsuccess, onerror)
+
+
+
+ ###
+ FOLDER CONTROLLER
+ ###
+ it 'should do a proper get all folders request', =>
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.getAllFolders()
+
+ expect(@req.get).toHaveBeenCalledWith('news_folders', {}, {}, angular.noop)
+
+
+ it 'should get a folder by id', =>
+ url =
+ folderId: 5
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.getFolderById(url.folderId)
+
+ expect(@req.get).toHaveBeenCalledWith('news_folder', url)
+
+
+ it 'send a correct collapse folder request', =>
+ url =
+ folderId: 3
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.collapseFolder(url.folderId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_collapse_folder', url)
+
+
+ it 'send a correct open folder request', =>
+ url =
+ folderId: 3
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.openFolder(url.folderId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_open_folder', url)
+
+
+ it 'should do a proper folder create request', =>
+ data =
+ folderName: 'check'
+ parentFolderId: 4
+
+ onsuccess = -> 1
+ onerror = -> 2
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.createFolder(data.folderName, data.parentFolderId, onsuccess, onerror)
+
+ expect(@req.post).toHaveBeenCalledWith('news_create_folder', {}, data,
+ onsuccess, onerror)
+
+
+ it 'should do a proper folder delete request', =>
+ url =
+ folderId: 2
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.deleteFolder(url.folderId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_delete_folder', url)
+
+
+ it 'should do a proper folder rename request', =>
+ url =
+ folderId: 2
+ data =
+ folderName: 'host'
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.renameFolder(url.folderId, data.folderName)
+
+ expect(@req.post).toHaveBeenCalledWith('news_rename_folder', url, data)
+
+
+ ###
+ ITEM CONTROLLER
+ ###
+ it 'should send a autopaging request', =>
+ data =
+ type: 2
+ id: 5
+ limit: @config.itemBatchSize
+ offset: 3
+
+ success = angular.noop
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.getItems(data.type, data.id, data.offset, success, null)
+
+ expect(@req.get).toHaveBeenCalledWith('news_items', {}, data, success)
+
+
+ it 'should send a load newest items request', =>
+ data =
+ type: 2
+ id: 5
+ updatedSince: 1333
+
+ success = angular.noop
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.getItems(data.type, data.id, 0, success, data.updatedSince)
+
+ expect(@req.get).toHaveBeenCalledWith('news_items', {}, data, success)
+
+
+ it 'send a correct get item by id request', =>
+ url =
+ itemId: 5
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.getItemById(url.itemId)
+
+ expect(@req.get).toHaveBeenCalledWith('news_item', url)
+
+
+
+ it 'send a correct get starred items request', =>
+ success = angular.noop
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.getStarredItems(success)
+
+ expect(@req.get).toHaveBeenCalledWith('news_starred_items', {}, {},
+ success)
+
+
+ it 'send a correct star item request', =>
+ url =
+ itemId: 2
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.starItem(url.itemId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_star_item', url)
+
+
+ it 'send a correct unstar item request', =>
+ url =
+ itemId: 2
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.unstarItem(url.itemId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_unstar_item', url)
+
+
+ it 'send a correct read item request', =>
+ url =
+ itemId: 2
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.readItem(url.itemId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_read_item', url)
+
+
+ it 'send a correct unread item request', =>
+ url =
+ itemId: 2
+
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.unreadItem(url.itemId)
+
+ expect(@req.post).toHaveBeenCalledWith('news_unread_item', url)
+
+
+ ###
+ EXPORT CONTROLLER
+ ###
+ it 'should have an export request', =>
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.exportOPML()
+
+ expect(@req.get).toHaveBeenCalledWith('news_export_opml')
+
+
+ ###
+ USERSETTINGS CONTROLLER
+ ###
+ it 'should do a proper get user settings read request', =>
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.userSettingsRead()
+
+ expect(@req.get).toHaveBeenCalledWith('news_user_settings_read', {}, {},
+ angular.noop)
+
+
+ it 'should do a proper get user settings read req and call callback', =>
+ callback = ->
+ 1 + 1
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.userSettingsRead(callback)
+
+ expect(@req.get).toHaveBeenCalledWith('news_user_settings_read', {}, {},
+ callback)
+
+
+ it 'should do a proper user settings read show request', =>
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.userSettingsReadShow()
+
+ expect(@req.post).toHaveBeenCalledWith('news_user_settings_read_show')
+
+
+
+ it 'should do a proper user settings read hide request', =>
+ pers = new @_Persistence(@req, @loading, @config, @active, @$rootScope)
+ pers.userSettingsReadHide()
+
+ expect(@req.post).toHaveBeenCalledWith('news_user_settings_read_hide') \ No newline at end of file
diff --git a/js/tests/services/showallSpec.coffee b/js/tests/services/showallSpec.coffee
new file mode 100644
index 000000000..65c163ccf
--- /dev/null
+++ b/js/tests/services/showallSpec.coffee
@@ -0,0 +1,42 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+
+describe '_ShowAll', ->
+
+
+ beforeEach module 'News'
+
+ beforeEach inject (@_ShowAll) =>
+
+
+ it 'should be false by default', =>
+ showAll = new @_ShowAll()
+
+ expect(showAll.getShowAll()).toBeFalsy()
+
+
+ it 'should set the correct showAll value', =>
+ showAll = new @_ShowAll()
+ showAll.handle(true)
+
+ expect(showAll.getShowAll()).toBeTruthy() \ No newline at end of file
diff --git a/js/tests/services/starredcountSpec.coffee b/js/tests/services/starredcountSpec.coffee
new file mode 100644
index 000000000..f7b619a95
--- /dev/null
+++ b/js/tests/services/starredcountSpec.coffee
@@ -0,0 +1,42 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+###
+
+
+describe '_StarredCount', ->
+
+
+ beforeEach module 'News'
+
+ beforeEach inject (@_StarredCount) =>
+
+
+ it 'should be 0 by default', =>
+ starred = new @_StarredCount()
+
+ expect(starred.getStarredCount()).toBe(0)
+
+
+ it 'should set the correct starred count', =>
+ starred = new @_StarredCount()
+ starred.handle(3)
+
+ expect(starred.getStarredCount()).toBe(3) \ No newline at end of file
diff --git a/js/tests/stubs/modules.js b/js/tests/stubs/modules.js
new file mode 100644
index 000000000..389718951
--- /dev/null
+++ b/js/tests/stubs/modules.js
@@ -0,0 +1,23 @@
+/**
+ * ownCloud - News
+ *
+ * @author Bernhard Posselt
+ * @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// module definition for testing
+angular.module('News', ['OC', 'ngMock']); \ No newline at end of file