From 2ce2277bcf80cd39b0dfe02294a9c6d28237523d Mon Sep 17 00:00:00 2001 From: brianc Date: Mon, 1 Nov 2010 20:37:19 -0400 Subject: [PATCH] updated type coercion test execution order to not fail due to slow query perf timeouts --- .../integration/client/type-coercion-tests.js | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/test/integration/client/type-coercion-tests.js b/test/integration/client/type-coercion-tests.js index b249629c..e33606fd 100644 --- a/test/integration/client/type-coercion-tests.js +++ b/test/integration/client/type-coercion-tests.js @@ -1,16 +1,16 @@ var helper = require(__dirname + '/test-helper'); -var client = helper.client(); - -client.query("create temp table test_type(col varchar(10))"); var testForTypeCoercion = function(type){ test("Coerces " + type.name, function() { - client.query("drop table test_type") - client.query("create temp table test_type(col " + type.name + ")"); type.values.forEach(function(val) { - client.query({ + var client = helper.client(); + + client.query("create temp table test_type(col " + type.name + ")"); + client.on('drain', client.end.bind(client)); + + var insertQuery = client.query({ name: 'insert type test ' + type.name, text: 'insert into test_type(col) VALUES($1)', values: [val] @@ -21,17 +21,14 @@ var testForTypeCoercion = function(type){ text: 'select col from test_type' }); - test('coerces ' + val + ' as ' + type.name, function() { - assert.emits(query, 'row', function(row) { - assert.strictEqual(row.fields[0], val); - }); + assert.emits(query, 'row', function(row) { + assert.strictEqual(row.fields[0], val); }); client.query({ name: 'delete values', text: 'delete from test_type' }); - }); }); }; @@ -68,4 +65,4 @@ var types = [{ types.forEach(testForTypeCoercion); -client.on('drain', client.end.bind(client)); +