mirror of
https://github.com/sstent/node.git
synced 2026-01-28 08:02:05 +00:00
first post
This commit is contained in:
17
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Query/errors/test-should-delegate-to-client-if-needed.js
generated
vendored
Normal file
17
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Query/errors/test-should-delegate-to-client-if-needed.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
var INVALID_QUERY = 'first invalid #*&% query';
|
||||
|
||||
var client = common.createClient();
|
||||
var err;
|
||||
|
||||
client.query(INVALID_QUERY);
|
||||
client .on('error', function(_err) {
|
||||
err = _err;
|
||||
client.destroy();
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.ok(err);
|
||||
assert.strictEqual(err.sql, INVALID_QUERY);
|
||||
});
|
||||
18
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Query/errors/test-should-emit-error-event.js
generated
vendored
Normal file
18
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Query/errors/test-should-emit-error-event.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
var INVALID_QUERY = 'first invalid #*&% query';
|
||||
|
||||
var client = common.createClient();
|
||||
var err;
|
||||
|
||||
client
|
||||
.query(INVALID_QUERY)
|
||||
.on('error', function(_err) {
|
||||
err = _err;
|
||||
client.destroy();
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.ok(err);
|
||||
assert.strictEqual(err.sql, INVALID_QUERY);
|
||||
});
|
||||
37
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Query/errors/test-should-not-leave-client-in-broken-state.js
generated
vendored
Normal file
37
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Query/errors/test-should-not-leave-client-in-broken-state.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
var INVALID_QUERY = 'first invalid #*&% query';
|
||||
|
||||
var client = common.createClient();
|
||||
var callbacks = [];
|
||||
|
||||
client.query(INVALID_QUERY, function(err) {
|
||||
assert.strictEqual(err.sql, INVALID_QUERY);
|
||||
callbacks.push(1);
|
||||
});
|
||||
|
||||
client.query('SHOW STATUS', function(err, rows, fields) {
|
||||
if (err) throw err;
|
||||
|
||||
assert.equal(rows.length >= 50, true);
|
||||
assert.equal(Object.keys(fields).length, 2);
|
||||
|
||||
callbacks.push(2);
|
||||
});
|
||||
|
||||
client.query(INVALID_QUERY, function(err) {
|
||||
assert.strictEqual(err.sql, INVALID_QUERY);
|
||||
|
||||
callbacks.push(3);
|
||||
});
|
||||
|
||||
client.query(INVALID_QUERY, function(err) {
|
||||
assert.strictEqual(err.sql, INVALID_QUERY);
|
||||
|
||||
client.destroy();
|
||||
callbacks.push(4);
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.deepEqual(callbacks, [1, 2, 3, 4]);
|
||||
});
|
||||
16
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Query/errors/test-should-raise-callback.js
generated
vendored
Normal file
16
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Query/errors/test-should-raise-callback.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
var INVALID_QUERY = 'first invalid #*&% query';
|
||||
|
||||
var client = common.createClient();
|
||||
|
||||
var err;
|
||||
client.query(INVALID_QUERY, function(_err) {
|
||||
err = _err;
|
||||
client.destroy();
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.ok(err);
|
||||
assert.strictEqual(err.sql, INVALID_QUERY);
|
||||
});
|
||||
Reference in New Issue
Block a user