From eaddd674b9281ff1830ecf79082e9f7b4d629864 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 23 May 2013 23:14:30 +0200 Subject: [PATCH] added error handling in lawnchair dao --- test/unit/lawnchair-dao-test.js | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test/unit/lawnchair-dao-test.js b/test/unit/lawnchair-dao-test.js index c9549b6..7894521 100644 --- a/test/unit/lawnchair-dao-test.js +++ b/test/unit/lawnchair-dao-test.js @@ -2,61 +2,61 @@ module("Lawnchair DAO"); var lawnchairdao_test = {}; -asyncTest("Init", 2, function() { +asyncTest("Init", 2, function() { // init dependencies lawnchairdao_test.jsonDao = new app.dao.LawnchairDAO(window); ok(lawnchairdao_test.jsonDao, 'LanwchairDAO'); - + // clear db before test lawnchairdao_test.jsonDao.clear(function() { ok(true, 'cleared db'); - + start(); - }); + }); }); asyncTest("CRUD object literal", 4, function() { - + var key = 'type_asdf'; var data = { - name : 'testName', - type : 'testType' + name: 'testName', + type: 'testType' }; // create - lawnchairdao_test.jsonDao.persist(key, data, function() { - + lawnchairdao_test.jsonDao.persist(key, data, function() { + // read lawnchairdao_test.jsonDao.read(key, function(read) { equal(data.name, read.name, 'Create, Read'); - + // list all - lawnchairdao_test.jsonDao.list('type',0 ,null, function(list) { + lawnchairdao_test.jsonDao.list('type', 0, null, function(list) { ok(list.length === 1, 'List'); - + // update var newName = 'updatedName'; read.name = newName; lawnchairdao_test.jsonDao.persist(key, read, function() { - + // read again lawnchairdao_test.jsonDao.read(key, function(updated) { equal(updated.name, newName, 'Update'); - + // delete lawnchairdao_test.jsonDao.remove(key, function() { - + // should read empty lawnchairdao_test.jsonDao.read(key, function(lastRead) { equal(lastRead, null, 'Delete'); - + start(); - }); + }); }); - + }); }); - }); - }); + }); + }); }); }); \ No newline at end of file