[Calendar] Update for proper finding
authorTomasz Kusmierz <t.kusmierz@samsung.com>
Tue, 8 Oct 2013 14:17:12 +0000 (16:17 +0200)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Tue, 8 Oct 2013 15:31:24 +0000 (15:31 +0000)
Change-Id: Ic4171e2b693f3b7c1cba8582782f99b44a1600f7

tct-calendar-tizen-tests/calendar/Calendar_update.html

index 2409a66c99b0263d9947ad090edbdb70d0c6414a..bb3e951c09333f43fe403dad4079dc069da458b8 100644 (file)
@@ -40,7 +40,8 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/calendar.html
 //==== TEST_CRITERIA MMINA MAST MR
 var t = async_test(document.title, {timeout: 5000}),
-    event, summary, eventSearchSuccessCallback, returnedValue, eventCalendar;
+    event, summary, eventSearchSuccessCallback, eventSearchErrorCallback,
+    returnedValue, eventCalendar, filter;
 
 t.step(function () {
 
@@ -50,17 +51,24 @@ t.step(function () {
     summary = "updated summary";
     event.summary = summary;
 
+    returnedValue = eventCalendar.update(event);
+    assert_equals(returnedValue, undefined,
+        "Incorect returned value from update method");
+
     eventSearchSuccessCallback = t.step_func(function (events) {
-        assert_equals(events[0].summary, summary, "Incorrect summary");
+        assert_type(events, "array", "events should be an array.");
+        assert_greater_than(events.length, 0, "Event was not found properly");
+        assert_equals(events[0].summary, summary,
+            "Event summary was not updated properly.");
         cleanup(eventCalendar);
         t.done();
     });
+    eventSearchErrorCallback = t.step_func(function (error) {
+        assert_unreached("find() error callaback invoked: " + error.name + ": " + error.message);
+    });
 
-    returnedValue = eventCalendar.update(event);
-    assert_equals(returnedValue, undefined,
-        "Incorect returned value from update method");
-
-    eventCalendar.find(eventSearchSuccessCallback);
+    filter = new tizen.AttributeFilter("id.uid", "EXACTLY", event.id.uid);
+    eventCalendar.find(eventSearchSuccessCallback, eventSearchErrorCallback, filter);
 });
 
 </script>