1 /* vi: set et sw=4 ts=4 si: */
3 * Copyright (c) 2012, Intel Corporation.
5 * This program is licensed under the terms and conditions of the
6 * Apache License, version 2.0. The full text of the Apache License is at
7 * http://www.apache.org/licenses/LICENSE-2.0
12 module("hoofbeats-library", {
14 window._tizen = window.tizen;
16 teardown: function() {
17 window.tizen = window._tizen;
21 test("scan when browser doesn't support Tizen web api",
23 var lib = new HoofbeatsLibrary();
24 window.tizen = undefined;
26 lib.scan({resolveBackend: DummyResolver});
27 }, Error, "scan throws Error");
30 test("successful scan", function() {
31 var lib = new HoofbeatsLibrary();
33 lib.scan({resolveBackend: DummyResolver}).then(function() {
34 ok(lib.getSize() > 0, "there are items in the library");
39 test("successful scan without resolving", function() {
40 var lib = new HoofbeatsLibrary();
42 lib.scan({resolveBackend: undefined}).then(function() {
43 ok(lib.getResolve() == false, "lib.getResolve() is false");
48 test("scan with count", function() {
49 var lib = new HoofbeatsLibrary();
51 lib.scan({count: 1, resolveBackend: DummyResolver}).then(function() {
52 ok(lib.getSize() == 1, "there is one item in the library");
57 test("get one item", function() {
58 var lib = new HoofbeatsLibrary(),
59 item_id = 'e7e7023b-54b3-41d5-b4a1-aa24498e0572';
62 lib.scan({count: 1, resolveBackend: DummyResolver}).then(function() {
63 var item = lib.item(item_id);
64 ok(item !== undefined, "item was found");
65 ok(item.id == item_id, "correct item was found");