Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should send/receive with async Gzip compression (>32kb)', function () {
var buf = new Buffer(90 * 1024), crc = crc32.signed(buf);
dataHandlerSpy.reset();
return producer.send({
topic: 'kafka-test-topic',
partition: 0,
message: { value: buf }
}, { codec: Kafka.COMPRESSION_GZIP })
.delay(300)
.then(function () {
dataHandlerSpy.should.have.been.called; // eslint-disable-line
dataHandlerSpy.lastCall.args[0].should.be.an('array').and.have.length(1);
dataHandlerSpy.lastCall.args[1].should.be.a('string', 'kafka-test-topic');
dataHandlerSpy.lastCall.args[2].should.be.a('number', 0);
dataHandlerSpy.lastCall.args[0][0].should.be.an('object');
.then(function () {
dataHandlerSpy.should.have.been.called; // eslint-disable-line
dataHandlerSpy.lastCall.args[0].should.be.an('array').and.have.length(1);
dataHandlerSpy.lastCall.args[1].should.be.a('string', 'kafka-test-topic');
dataHandlerSpy.lastCall.args[2].should.be.a('number', 0);
dataHandlerSpy.lastCall.args[0][0].should.be.an('object');
dataHandlerSpy.lastCall.args[0][0].should.have.property('message').that.is.an('object');
dataHandlerSpy.lastCall.args[0][0].message.should.have.property('value');
crc32.signed(dataHandlerSpy.lastCall.args[0][0].message.value).should.be.eql(crc);
});
});
function hash(sess) {
return crc32.signed(JSON.stringify(sess, function(key, val){
if ('cookie' != key) return val;
}));
}
function hash(sess) {
return crc32.signed(JSON.stringify(sess, function(key, val){
if ('cookie' != key) return val;
}));
}
function hash(sess) {
return crc32.signed(JSON.stringify(sess, function(key, val){
if ('cookie' != key) return val;
}));
}
function hash(sess) {
return crc32.signed(JSON.stringify(sess, function(key, val){
if ('cookie' != key) return val;
}));
}
function hash(sess) {
return crc32.signed(JSON.stringify(sess, function(key, val){
if ('cookie' != key) return val;
}));
}
function hash(sess) {
return crc32.signed(JSON.stringify(sess, function(key, val){
if ('cookie' != key) return val;
}));
}
function hash(sess) {
return crc32.signed(JSON.stringify(sess, function(key, val){
if ('cookie' != key) return val;
}));
}