| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/memcache-plus/test/ |
Upload File : |
require('chai').should();
var Connection = require('../lib/connection');
describe('Connection', function() {
var connection;
beforeEach(function() {
connection = new Connection();
});
it('initializes with defaults', function() {
connection.should.have.property('host');
connection.host.should.be.a('string');
connection.should.have.property('port');
connection.port.should.be.a('string');
});
it('initiates connection', function() {
connection.should.have.property('client');
connection.client.should.be.ok;
});
it('does connect', function(done) {
connection.on('connect', function() {
done();
});
});
it('reconnects, if enabled and connection lost', function(done) {
connection.on('connect', function() {
connection.client.end();
connection.on('connect', function() {
done();
});
});
});
describe('does not reconnect when', function() {
it('reconnect is disabled and connection lost', function(done) {
connection = new Connection({ reconnect: false });
connection.on('connect', function() {
connection.client.end();
connection.on('connect', function() {
done(new Error('The client should not have attempted to reconnect'));
});
setTimeout(function() {
done();
}, 50);
});
});
it('intentionally disconnected', function(done) {
connection = new Connection();
connection.on('connect', function() {
connection.disconnect();
connection.on('connect', function() {
done(new Error('The client should not have attempted to reconnect'));
});
setTimeout(function() {
done();
}, 50);
});
});
});
afterEach(function() {
connection.disconnect();
});
});