mirror of
https://github.com/sstent/node.git
synced 2026-01-27 23:51:45 +00:00
first post
This commit is contained in:
11
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/commands/test-ping.js
generated
vendored
Normal file
11
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/commands/test-ping.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
|
||||
var client = common.createClient();
|
||||
client.ping(function(err, result) {
|
||||
if (err) throw err;
|
||||
|
||||
assert.strictEqual(result.affectedRows, 0);
|
||||
|
||||
client.end();
|
||||
});
|
||||
10
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/commands/test-statistics.js
generated
vendored
Normal file
10
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/commands/test-statistics.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
|
||||
var client = common.createClient();
|
||||
client.statistics(function(err, result) {
|
||||
if (err) throw err;
|
||||
|
||||
assert.ok(result.extra.match(/time/i));
|
||||
client.end();
|
||||
});
|
||||
13
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/commands/test-useDatabase.js
generated
vendored
Normal file
13
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/commands/test-useDatabase.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
|
||||
var client = common.createClient();
|
||||
client.useDatabase(common.TEST_DB, function(err, result) {
|
||||
// The TEST_DB may not exist right now, so ignore errors related to that
|
||||
if (err && err.number === mysql.ERROR_BAD_DB_ERROR) err = null;
|
||||
|
||||
if (err) throw err;
|
||||
|
||||
assert.strictEqual(result.affectedRows, 0);
|
||||
client.end();
|
||||
});
|
||||
11
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-automatic-connect.js
generated
vendored
Normal file
11
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-automatic-connect.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
|
||||
var client = common.createClient();
|
||||
client.query('SELECT 1', function(err, results) {
|
||||
if (err) throw err;
|
||||
|
||||
assert.deepEqual(results, [{1: 1}]);
|
||||
|
||||
client.end();
|
||||
});
|
||||
24
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-automatic-reconnect-on-timeout.js
generated
vendored
Normal file
24
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-automatic-reconnect-on-timeout.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
|
||||
var client = common.createClient();
|
||||
// Not sure if we need all 3 of these, but they do the trick
|
||||
client.query('SET interactive_timeout = 1');
|
||||
client.query('SET wait_timeout = 1');
|
||||
client.query('SET net_read_timeout = 1');
|
||||
|
||||
var result;
|
||||
client._socket.on('end', function() {
|
||||
assert.equal(client.connected, false);
|
||||
|
||||
client.query('SELECT 1', function(err, _result) {
|
||||
if (err) throw err;
|
||||
|
||||
result = _result;
|
||||
client.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.deepEqual(result, [{'1': 1}]);
|
||||
});
|
||||
24
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-bad-credentials.js.js
generated
vendored
Normal file
24
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-bad-credentials.js.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
|
||||
var client = common.createClient();
|
||||
client.password = 'thispassworddoesnotreallywork';
|
||||
|
||||
var callbacks = [];
|
||||
client.query('SELECT 1', function(err) {
|
||||
assert.ok(/access denied/i.test(err.message));
|
||||
|
||||
callbacks.push(1);
|
||||
});
|
||||
|
||||
client.query('SELECT 2', function(err) {
|
||||
assert.ok(/access denied/i.test(err.message));
|
||||
|
||||
callbacks.push(2);
|
||||
|
||||
client.destroy();
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.deepEqual(callbacks, [1, 2]);
|
||||
});
|
||||
25
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-connection-errors-go-to-callback.js.js
generated
vendored
Normal file
25
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-connection-errors-go-to-callback.js.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
|
||||
var client = common.createClient();
|
||||
// Port number outside of range -> triggers connection error
|
||||
client.port = 999999999;
|
||||
|
||||
var callbacks = [];
|
||||
client.query('SELECT 1', function(err) {
|
||||
assert.ok(err);
|
||||
|
||||
callbacks.push(1);
|
||||
});
|
||||
|
||||
client.query('SELECT 2', function(err) {
|
||||
assert.ok(err);
|
||||
|
||||
callbacks.push(2);
|
||||
|
||||
client.destroy();
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.deepEqual(callbacks, [1, 2]);
|
||||
});
|
||||
27
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-reconnect-closed-client.js.js
generated
vendored
Normal file
27
Nodejs-Socketio-Mysql-Demo/node_modules/mysql/test/integration/Client/connection/test-reconnect-closed-client.js.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
var common = require('../../../common');
|
||||
var assert = require('assert');
|
||||
|
||||
var client = common.createClient();
|
||||
var callbacks = [];
|
||||
client.query('SELECT 1', function(err, results) {
|
||||
if (err) throw err;
|
||||
|
||||
callbacks.push(1);
|
||||
});
|
||||
|
||||
client.end(function(err) {
|
||||
if (err) throw err;
|
||||
|
||||
callbacks.push(2);
|
||||
});
|
||||
|
||||
client.query('SELECT 1', function(err) {
|
||||
if (err) throw err;
|
||||
|
||||
callbacks.push(3);
|
||||
client.destroy();
|
||||
});
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.deepEqual(callbacks, [1, 2, 3]);
|
||||
});
|
||||
Reference in New Issue
Block a user