Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add a failing async test

  • Loading branch information...
commit 453ce2477b7515dd933c8020e93537e7456ed240 1 parent 6c7643f
@ssinghi ssinghi authored committed
Showing with 12 additions and 2 deletions.
  1. +12 −2 tests/test-async.js
View
14 tests/test-async.js
@@ -23,8 +23,18 @@ exports.async = function (test) {
exports.queryAsync = function (test) {
var conn = mysql_libmysqlclient.createConnection(cfg.host, cfg.user, cfg.password, cfg.database);
-
- conn.queryAsync("SHOW TABLES;", function (result) {
+
+ res = conn.query("DROP TABLE IF EXISTS " + cfg.test_table + ";");
+ res = conn.query("CREATE TABLE " + cfg.test_table +
+ " (autoincrement_id BIGINT NOT NULL AUTO_INCREMENT," +
+ " random_number INT(8) NOT NULL, random_boolean BOOLEAN NOT NULL," +
+ " PRIMARY KEY (autoincrement_id)) TYPE=MEMORY;");
+
+ test.expect(2);
+ conn.queryAsync("SHOW TABLES", function (result) {
+ test.ok(result.fieldCount() == 1, "show results field count == 1");
+ var res = result.fetchAll();
+ test.ok(res.some(function(r) {return r['Tables_in_' + cfg.database] == cfg.test_table;}), "find the test table in results");
conn.close();
test.done();
});

0 comments on commit 453ce24

Please sign in to comment.
Something went wrong with that request. Please try again.