summaryrefslogtreecommitdiffstats
path: root/js/tests/unit/models/ItemSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/unit/models/ItemSpec.js')
-rw-r--r--js/tests/unit/models/ItemSpec.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/js/tests/unit/models/ItemSpec.js b/js/tests/unit/models/ItemSpec.js
new file mode 100644
index 000000000..85ee5789e
--- /dev/null
+++ b/js/tests/unit/models/ItemSpec.js
@@ -0,0 +1,43 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2014
+ */
+describe('Item', function () {
+ 'use strict';
+
+ beforeEach(module('News'));
+
+
+ it('should receive the newestItemId', inject(function (Item) {
+ Item.receive(3, 'newestItemId');
+
+ expect(Item.getNewestItemId()).toBe(3);
+ }));
+
+
+ it('should receive the newestItemId', inject(function (Item) {
+ Item.receive(2, 'starred');
+
+ expect(Item.getStarredCount()).toBe(2);
+ }));
+
+
+ it('should receive items', inject(function (Item) {
+ Item.receive([
+ {
+ id: 3
+ },
+ {
+ id: 4
+ }
+ ], 'items');
+
+ expect(Item.size()).toBe(2);
+ }));
+
+}); \ No newline at end of file