removed redundant parser tests

This commit is contained in:
brianc 2010-10-10 22:29:16 -05:00
parent c511997c4d
commit 390593ba1e
2 changed files with 0 additions and 128 deletions

View File

@ -125,16 +125,6 @@ var Parser = function(buffer) {
var p = Parser.prototype;
p.parse = function() {
var messages = [];
var message = this.parseMessage();
while(message) {
messages.push(message);
message = this.parseMessage();
}
return messages;
};
p.parseMessage = function() {
if(this.buffer.length == this.offset) {
return false;

View File

@ -290,121 +290,3 @@ test('Client', function() {
});
});
test('Parser on single messages', function() {
test('parses AuthenticationOk message', function() {
var result = PARSE(authOkBuffer)[0];
assert.same(result, expectedAuthenticationOkayMessage);
});
test('parses ParameterStatus message', function() {
var result = PARSE(paramStatusBuffer)[0];
assert.same(result, expectedParameterStatusMessage);
});
test('parses BackendKeyData message', function() {
var result = PARSE(backendKeyDataBuffer)[0];
assert.same(result, expectedBackendKeyDataMessage);
});
test('parses ReadyForQuery message', function() {
var result = PARSE(readyForQueryBuffer)[0];
assert.same(result, expectedReadyForQueryMessage);
});
test('parses CommandComplete message', function() {
var result = PARSE(commandCompleteBuffer)[0];
assert.same(result, expectedCommandCompleteMessage);
});
test('parses RowDescriptions', function() {
test('parses empty row description', function() {
var result = PARSE(emptyRowDescriptionBuffer)[0];
assert.same(result, expectedEmptyRowDescriptionMessage);
assert.equal(result.fields.length, 0);
});
test('parses single row description',function() {
var result = PARSE(oneRowDescBuff)[0];
assert.same(result, expectedOneRowMessage);
assert.equal(result.fields.length, 1);
assert.same(result.fields[0], {
name: 'id',
tableID: 1,
columnID: 2,
dataType: 3,
dataTypeSize: 4,
dataTypeModifier: 5,
format: 'text'
});
});
test('parses two row descriptions', function() {
var result = PARSE(twoRowBuf)[0];
assert.same(result, expectedTwoRowMessage);
assert.equal(result.fields.length, 2);
assert.same(result.fields[0], {
name: 'bang',
tableID: 1,
columnID: 2,
dataType: 3,
dataTypeSize: 4,
dataTypeModifier: 5,
format: 'text'
});
assert.same(result.fields[1], {
name: 'whoah',
tableID: 10,
columnID: 11,
dataType: 12,
dataTypeSize: 13,
dataTypeModifier: 14,
format: 'text'
});
});
});
test('parses raw data row buffers', function() {
var emptyRowFieldBuf = new BufferList()
.addInt16(0)
.join(true, 'D');
test('parses empty data row', function() {
var result = PARSE(emptyRowFieldBuf)[0];
assert.equal(result.fieldCount, 0);
assert.equal(result.fields.length, 0);
});
var oneFieldBuf = new BufferList()
.addInt16(1) //number of fields
.addInt32(5) //length of bytes of fields
.addCString('test')
.join(true, 'D');
test('parses single field data row', function() {
var result = PARSE(oneFieldBuf)[0];
assert.equal(result.fieldCount, 1);
assert.equal(result.fields[0], "test\0");
});
});
test('parsing empty buffer returns false', function() {
var parser = PARSE(Buffer(0));
assert.equal(parser, false);
});
});