Skip to content

Commit d207947

Browse files
committed
change name of assert.raises to assert.emits
1 parent 405fbbe commit d207947

13 files changed

+42
-42
lines changed

test/integration/client/empty-query-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ var client = helper.client();
33

44
test("empty query message handling", function() {
55
client.query("");
6-
assert.raises(client.connection, 'emptyQuery');
6+
assert.emits(client.connection, 'emptyQuery');
77
client.on('drain', client.end.bind(client));
88
});

test/integration/client/error-handling-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var helper = require(__dirname + '/test-helper');
33
test('error handling', function(){
44
var client = helper.client();
55
client.query("select omfg from yodas_soda where pixistix = 'zoiks!!!'");
6-
assert.raises(client, 'error', function(error) {
6+
assert.emits(client, 'error', function(error) {
77
assert.equal(error.severity, "ERROR");
88
client.end();
99
});

test/integration/client/no-data-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test("noData message handling", function() {
2626
values: [101]
2727
});
2828

29-
assert.raises(query, 'row', function(row) {
29+
assert.emits(query, 'row', function(row) {
3030
assert.strictEqual(row.fields[0],100)
3131
});
3232

test/integration/client/prepared-statement-tests.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ test("simple, unnamed prepared statement", function(){
88
values: ['Brian']
99
});
1010

11-
assert.raises(query, 'row', function(row) {
11+
assert.emits(query, 'row', function(row) {
1212
assert.equal(row.fields[0], 20);
1313
});
1414

15-
assert.raises(query, 'end', function() {
15+
assert.emits(query, 'end', function() {
1616
client.end();
1717
});
1818
});
@@ -38,11 +38,11 @@ test("named prepared statement", function() {
3838
});
3939
});
4040

41-
assert.raises(query, 'row', function(row) {
41+
assert.emits(query, 'row', function(row) {
4242
assert.equal(row.fields[0], 'Brian');
4343
});
4444

45-
assert.raises(query, 'end', function() {
45+
assert.emits(query, 'end', function() {
4646
test("query was parsed", function() {
4747
assert.equal(parseCount, 1);
4848
});
@@ -56,11 +56,11 @@ test("named prepared statement", function() {
5656
values: [10, 'A%']
5757
});
5858

59-
assert.raises(cachedQuery, 'row', function(row) {
59+
assert.emits(cachedQuery, 'row', function(row) {
6060
assert.equal(row.fields[0], 'Aaron');
6161
});
6262

63-
assert.raises(cachedQuery, 'end', function() {
63+
assert.emits(cachedQuery, 'end', function() {
6464
test("query was only parsed one time", function() {
6565
assert.equal(parseCount, 1, "Should not have reparsed query");
6666
});
@@ -74,19 +74,19 @@ test("named prepared statement", function() {
7474
});
7575

7676
test("gets first row", function() {
77-
assert.raises(q, 'row', function(row) {
77+
assert.emits(q, 'row', function(row) {
7878
assert.equal(row.fields[0], "Aaron");
7979

8080
test("gets second row", function() {
81-
assert.raises(q, 'row', function(row) {
81+
assert.emits(q, 'row', function(row) {
8282
assert.equal(row.fields[0], "Brian");
8383
});
8484
});
8585

8686
});
8787
});
8888

89-
assert.raises(q, 'end', function() {
89+
assert.emits(q, 'end', function() {
9090
assert.equal(parseCount, 1);
9191
});
9292
});
@@ -111,12 +111,12 @@ test("prepared statements on different clients", function() {
111111
text: statement1
112112
});
113113
test('gets right data back', function() {
114-
assert.raises(query, 'row', function(row) {
114+
assert.emits(query, 'row', function(row) {
115115
assert.equal(row.fields[0], 26);
116116
});
117117
});
118118

119-
assert.raises(query, 'end', function() {
119+
assert.emits(query, 'end', function() {
120120
if(client2Finished) {
121121
client1.end();
122122
client2.end();
@@ -135,12 +135,12 @@ test("prepared statements on different clients", function() {
135135
});
136136

137137
test('gets right data', function() {
138-
assert.raises(query, 'row', function(row) {
138+
assert.emits(query, 'row', function(row) {
139139
assert.equal(row.fields[0], 1);
140140
});
141141
});
142142

143-
assert.raises(query, 'end', function() {
143+
assert.emits(query, 'end', function() {
144144
if(client1Finished) {
145145
client1.end();
146146
client2.end();

test/integration/client/simple-query-tests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test("simple query interface", function() {
1313
rows.push(row.fields[0])
1414
});
1515

16-
assert.raises(query, 'end', function() {
16+
assert.emits(query, 'end', function() {
1717
test("returned right number of rows", function() {
1818
assert.length(rows, 26);
1919
});
@@ -29,9 +29,9 @@ test("multiple simple queries", function() {
2929
client.query("create temp table bang(id serial, name varchar(5));insert into bang(name) VALUES('boom');")
3030
client.query("insert into bang(name) VALUES ('yes');");
3131
var query = client.query("select name from bang");
32-
assert.raises(query, 'row', function(row) {
32+
assert.emits(query, 'row', function(row) {
3333
assert.equal(row.fields[0], 'boom');
34-
assert.raises(query, 'row', function(row) {
34+
assert.emits(query, 'row', function(row) {
3535
assert.equal(row.fields[0],'yes');
3636
});
3737
});

test/integration/client/type-coercion-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var testForTypeCoercion = function(type){
2222
});
2323

2424
test('coerces ' + val + ' as ' + type.name, function() {
25-
assert.raises(query, 'row', function(row) {
25+
assert.emits(query, 'row', function(row) {
2626
assert.strictEqual(row.fields[0], val);
2727
});
2828
});

test/integration/connection/bound-command-tests.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ test('flushing once', function() {
1111
con.execute();
1212
con.flush();
1313

14-
assert.raises(con, 'parseComplete');
15-
assert.raises(con, 'bindComplete');
16-
assert.raises(con, 'dataRow');
17-
assert.raises(con, 'commandComplete', function(){
14+
assert.emits(con, 'parseComplete');
15+
assert.emits(con, 'bindComplete');
16+
assert.emits(con, 'dataRow');
17+
assert.emits(con, 'commandComplete', function(){
1818
con.sync();
1919
});
20-
assert.raises(con, 'readyForQuery', function(){
20+
assert.emits(con, 'readyForQuery', function(){
2121
con.end();
2222
});
2323

@@ -27,24 +27,24 @@ test('flushing once', function() {
2727
test("sending many flushes", function() {
2828
helper.connect(function(con) {
2929

30-
assert.raises(con, 'parseComplete', function(){
30+
assert.emits(con, 'parseComplete', function(){
3131
con.bind();
3232
con.flush();
3333
});
3434

35-
assert.raises(con, 'bindComplete', function(){
35+
assert.emits(con, 'bindComplete', function(){
3636
con.execute();
3737
con.flush();
3838
});
3939

40-
assert.raises(con, 'dataRow', function(msg){
40+
assert.emits(con, 'dataRow', function(msg){
4141
assert.equal(msg.fields[0], 1);
42-
assert.raises(con, 'dataRow', function(msg){
42+
assert.emits(con, 'dataRow', function(msg){
4343
assert.equal(msg.fields[0], 2);
44-
assert.raises(con, 'commandComplete', function(){
44+
assert.emits(con, 'commandComplete', function(){
4545
con.sync();
4646
});
47-
assert.raises(con, 'readyForQuery', function(){
47+
assert.emits(con, 'readyForQuery', function(){
4848
con.end();
4949
});
5050
});

test/integration/connection/notification-tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ var helper = require(__dirname + '/test-helper');
33
test('recieves notification from same connection with no payload', function() {
44
helper.connect(function(con) {
55
con.query('LISTEN boom');
6-
assert.raises(con, 'readyForQuery', function() {
6+
assert.emits(con, 'readyForQuery', function() {
77
con.query("NOTIFY boom");
8-
assert.raises(con, 'notification', function(msg) {
8+
assert.emits(con, 'notification', function(msg) {
99
assert.equal(msg.payload, "");
1010
assert.equal(msg.channel, 'boom')
1111
con.end();

test/integration/connection/query-tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ var rows = [];
77
test('simple query', function() {
88
helper.connect(function(con) {
99
con.query('select * from ids');
10-
assert.raises(con, 'dataRow');
10+
assert.emits(con, 'dataRow');
1111
con.on('dataRow', function(msg) {
1212
rows.push(msg.fields);
1313
});
14-
assert.raises(con, 'readyForQuery', function() {
14+
assert.emits(con, 'readyForQuery', function() {
1515
con.end();
1616
});
1717
});

test/test-helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ assert.same = function(actual, expected) {
1717
};
1818

1919

20-
assert.raises = function(item, eventName, callback) {
20+
assert.emits = function(item, eventName, callback) {
2121
var called = false;
2222
var id = setTimeout(function() {
2323
test("Should have called " + eventName, function() {
@@ -62,7 +62,7 @@ assert.length = function(actual, expectedLength) {
6262
assert.equal(actual.length, expectedLength);
6363
};
6464

65-
['equal', 'length', 'empty', 'strictEqual', 'raises', 'equalBuffers', 'same', 'ok'].forEach(function(name) {
65+
['equal', 'length', 'empty', 'strictEqual', 'emits', 'equalBuffers', 'same', 'ok'].forEach(function(name) {
6666
var old = assert[name];
6767
assert[name] = function() {
6868
test.assertCount++

0 commit comments

Comments
 (0)