Check the stored data in the unit test

This commit is contained in:
Chris Brody 2012-05-05 23:52:49 +02:00
parent 4efc1c9968
commit e41ff8193b
1 changed files with 22 additions and 2 deletions

View File

@ -24,7 +24,7 @@
ok(!!db, "db object");
stop(6);
stop(9);
db.transaction(function(tx) {
@ -49,7 +49,7 @@
start(1);
ok(!!tx, "second tx object");
tx.executeSql("select count(id) as cnt from test_table;", [], function(tx, res) {
tx.executeSql("SELECT count(id) as cnt from test_table;", [], function(tx, res) {
start(1);
console.log("res.rows.length: " + res.rows.length + " -- should be 1");
@ -59,6 +59,13 @@
equal(res.rows.item(0).cnt, 1, "select count");
});
tx.executeSql("SELECT data_num from test_table;", [], function(tx, res) {
start(1);
equal(res.rows.length, 1, "SELECT res rows length");
equal(res.rows.item(0).data_num, 100, "SELECT data_num");
});
tx.executeSql("UPDATE test_table SET data_num = ? WHERE data_num = 100", [101], function(tx, res) {
start(1);
@ -67,6 +74,13 @@
equal(res.rowsAffected, 1, "UPDATE res rows affected"); /* issue #22 (Android) */
});
tx.executeSql("SELECT data_num from test_table;", [], function(tx, res) {
start(1);
equal(res.rows.length, 1, "SELECT res rows length");
equal(res.rows.item(0).data_num, 101, "SELECT data_num");
});
tx.executeSql("DELETE FROM test_table WHERE data LIKE 'tes%'", [], function(tx, res) {
start(1);
@ -75,6 +89,12 @@
equal(res.rowsAffected, 1, "DELETE res rows affected"); /* issue #22 (Android) */
});
tx.executeSql("SELECT data_num from test_table;", [], function(tx, res) {
start(1);
equal(res.rows.length, 0, "SELECT res rows length");
});
});
}, function(e) {