mirror of
https://github.com/moparisthebest/PhoneGap-SQLitePlugin-Android
synced 2025-02-16 06:50:14 -05:00
Check the stored data in the unit test
This commit is contained in:
parent
4efc1c9968
commit
e41ff8193b
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user