1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-10 11:43:01 +03:00
Files
node-redis/test/commands/sync.spec.js
Ruben Bridgewater 5f261c5823 Minor changes
Move utility functions in lib/utils.js
Improve the js parser in cases the buffer is incomplete
Rename lib/parser to lib/parsers

Fix smaller issues with test suite and fix parser errors not being catched

Fixed wrong test for the new .end flush parameter
Fixed test suite options being partly mutated
Add some more tests
2015-09-25 02:12:48 +02:00

44 lines
1.4 KiB
JavaScript

'use strict';
var assert = require('assert');
var config = require("../lib/config");
var helper = require("../helper");
var redis = config.redis;
describe("The 'sync' method", function () {
helper.allTests(function(parser, ip, args) {
describe("using " + parser + " and " + ip, function () {
var client;
beforeEach(function (done) {
client = redis.createClient.apply(redis.createClient, args);
client.once("connect", function () {
client.flushdb(done);
});
});
// This produces a parser error
// Protocol error, got "K" as reply type byte
// I'm uncertain if this is correct behavior or not
it('try to sync with the server and fail other commands', function (done) {
client.on('error', function(err) {
assert.equal(err.message, 'Protocol error, got "K" as reply type byte');
assert.equal(err.command, 'SET');
done();
});
client.sync(function(err, res) {
assert.equal(err, null);
assert(!!res);
});
client.set('foo', 'bar');
});
afterEach(function () {
client.end();
});
});
});
});