node-postgres/test/unit/client/cleartext-password-tests.js
Gurjeet Singh 6530ce27fe Miscellaneous improvements in unit tests.
End statements with semicolons, to be consistent with the surrounding
code.

Added a new unit test to ensure environment variables are honored when
parsing a
connection string.

Added a TODO to cleanup a test that emits messages using console.log().

Correct a query's syntax. Looks like a good thing to do even though the
syntax
doesn't matter in mocked out tests.

Removed a test that tests for SELECT tags; AFAIK, SELECT commands don't
emit a
tag.
2014-06-15 17:33:23 -04:00

22 lines
612 B
JavaScript

require(__dirname+'/test-helper');
/*
* TODO: Add _some_ comments to explain what it is we're testing, and how the
* code-being-tested works behind the scenes.
*/
test('cleartext password authentication', function(){
var client = createClient();
client.password = "!";
client.connection.stream.packets = [];
client.connection.emit('authenticationCleartextPassword');
test('responds with password', function() {
var packets = client.connection.stream.packets;
assert.lengthIs(packets, 1);
var packet = packets[0];
assert.equalBuffers(packet, [0x70, 0, 0, 0, 6, 33, 0]);
});
});