A Twitch.tv viewer reward and games system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
1.1 KiB

var common = require('../common');
var test = require('utest');
var assert = require('assert');
var Charsets = require(common.lib + '/protocol/constants/charsets');
var ConnectionConfig = require(common.lib + '/ConnectionConfig');
test('ConnectionConfig#Constructor', {
'takes user,pw,host,port,db from url string': function() {
var url = 'mysql://myuser:mypass@myhost:3333/mydb';
var config = new ConnectionConfig(url);
assert.equal(config.host, 'myhost');
assert.equal(config.port, 3333);
assert.equal(config.user, 'myuser');
assert.equal(config.password, 'mypass');
assert.equal(config.database, 'mydb');
},
'allows additional options via url query': function() {
var url = 'mysql://myhost/mydb?debug=true&charset=BIG5_CHINESE_CI';
var config = new ConnectionConfig(url);
assert.equal(config.host, 'myhost');
assert.equal(config.port, 3306);
assert.equal(config.database, 'mydb');
assert.equal(config.debug, true);
assert.equal(config.charsetNumber, Charsets.BIG5_CHINESE_CI);
},
});