Skip to content

Commit 392c952

Browse files
author
Kyle Farris
committed
Fixed some code formatting things.
1 parent 952d3a9 commit 392c952

4 files changed

Lines changed: 68 additions & 68 deletions

File tree

test/mssql/00-AA-tests-general.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const should = require('chai').should();
2-
3-
describe('MSSQL: QueryBuilder', () => {
4-
it('actually exists and can be initialized', () => {
5-
const QueryBuilder = require('../../drivers/mssql/query_builder.js');
6-
const qb = new QueryBuilder();
7-
qb.should.be.instanceOf(QueryBuilder);
8-
});
9-
});
1+
const should = require('chai').should();
2+
3+
describe('MSSQL: QueryBuilder', () => {
4+
it('actually exists and can be initialized', () => {
5+
const QueryBuilder = require('../../drivers/mssql/query_builder.js');
6+
const qb = new QueryBuilder();
7+
qb.should.be.instanceOf(QueryBuilder);
8+
});
9+
});

test/mssql/01-tests-where_in.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,40 +38,40 @@ describe('MSSQL: where_in()', () => {
3838
it('should not accept anything but a non-empty array of values as second parameter', () => {
3939
qb.reset_query();
4040
expect(() => qb.where_in('planet'), 'nothing provided').to.throw(Error);
41-
expect(() => qb.where_in('planet',null), 'null provided').to.throw(Error);
42-
expect(() => qb.where_in('planet',false), 'false provided').to.throw(Error);
43-
expect(() => qb.where_in('planet',true), 'true provided').to.throw(Error);
44-
expect(() => qb.where_in('planet',{}), 'empty object provided').to.throw(Error);
45-
expect(() => qb.where_in('planet',{foo:'bar'}), 'empty object provided').to.throw(Error);
46-
expect(() => qb.where_in('planet',3), 'integer provided').to.throw(Error);
47-
expect(() => qb.where_in('planet',3.5), 'float provided').to.throw(Error);
48-
expect(() => qb.where_in('planet',NaN), 'NaN provided').to.throw(Error);
49-
expect(() => qb.where_in('planet',Infinity), 'Infinity provided').to.throw(Error);
50-
expect(() => qb.where_in('planet',[]), 'empty array provided').to.throw(Error);
51-
expect(() => qb.where_in('planet',''), 'empty string provided').to.throw(Error);
52-
expect(() => qb.where_in('planet',/foobar/), 'regex provided').to.throw(Error);
41+
expect(() => qb.where_in('planet', null), 'null provided').to.throw(Error);
42+
expect(() => qb.where_in('planet', false), 'false provided').to.throw(Error);
43+
expect(() => qb.where_in('planet', true), 'true provided').to.throw(Error);
44+
expect(() => qb.where_in('planet', {}), 'empty object provided').to.throw(Error);
45+
expect(() => qb.where_in('planet', {foo:'bar'}), 'empty object provided').to.throw(Error);
46+
expect(() => qb.where_in('planet', 3), 'integer provided').to.throw(Error);
47+
expect(() => qb.where_in('planet', 3.5), 'float provided').to.throw(Error);
48+
expect(() => qb.where_in('planet', NaN), 'NaN provided').to.throw(Error);
49+
expect(() => qb.where_in('planet', Infinity), 'Infinity provided').to.throw(Error);
50+
expect(() => qb.where_in('planet', []), 'empty array provided').to.throw(Error);
51+
expect(() => qb.where_in('planet', ''), 'empty string provided').to.throw(Error);
52+
expect(() => qb.where_in('planet', /foobar/), 'regex provided').to.throw(Error);
5353

54-
expect(() => qb.where_in('planet',['Mars','Earth','Venus','Mercury']), 'non-empty array provided').to.not.throw(Error);
54+
expect(() => qb.where_in('planet', ['Mars','Earth','Venus','Mercury']), 'non-empty array provided').to.not.throw(Error);
5555
});
5656
it('should require both a field name an array of values as first and second parameters, respectively', () => {
5757
qb.reset_query();
58-
qb.where_in('planet_position',[1,2,3]);
58+
qb.where_in('planet_position', [1,2,3]);
5959
qb.where_array.should.eql(['[planet_position] IN (1, 2, 3)']);
6060
});
6161
it('should concatenate multiple WHERE IN clauses with AND ', () => {
6262
qb.reset_query();
6363
qb.where_in('planet',['Mercury','Venus','Earth','Mars']);
64-
qb.where_in('galaxy_id',[123,456,789,0110]);
64+
qb.where_in('galaxy_id', [123,456,789,0110]);
6565
qb.where_array.should.eql(["[planet] IN ('Mercury', 'Venus', 'Earth', 'Mars')","AND [galaxy_id] IN (123, 456, 789, 72)"]);
6666
});
6767
it('should be chainable', () => {
6868
qb.reset_query();
69-
qb.where_in('planet',['Mercury','Venus','Earth','Mars']).where_in('planet_position',[1,2,3,4]);
69+
qb.where_in('planet', ['Mercury','Venus','Earth','Mars']).where_in('planet_position',[1,2,3,4]);
7070
qb.where_array.should.eql(["[planet] IN ('Mercury', 'Venus', 'Earth', 'Mars')","AND [planet_position] IN (1, 2, 3, 4)"]);
7171
});
7272
it('should not escape fields if asked not to', () => {
7373
qb.reset_query();
74-
qb.where_in('planet_position',[1,2,3],false);
74+
qb.where_in('planet_position', [1, 2, 3],false);
7575
qb.where_array.should.eql(['planet_position IN (1, 2, 3)']);
7676
});
7777
});
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
const should = require('chai').should();
2-
const expect = require('chai').expect;
3-
const settings = require('../configs').mssql;
4-
5-
const check = (done, f) => {
6-
try {
7-
f();
8-
done();
9-
} catch(e) {
10-
done(e);
11-
}
12-
};
13-
14-
const QueryBuilder = require('../../index.js');
15-
const pool = new QueryBuilder(settings, 'mssql', 'pool');
16-
17-
describe('MSSQL: Multiple Queries', () => {
18-
it('should not get confused about table after deleting records', done => {
19-
pool.get_connection(qb => {
20-
qb.limit(1).delete('cities', (err, result) => {
21-
qb.select(['city', 'state_code']).from('cities').limit(1).get((err2, result2) => {
22-
qb.release();
23-
check(done, () => {
24-
expect(err, 'should not error on delete').to.not.be.instanceof(Error);
25-
expect(result.affected_rows, 'one record should be deleted').to.be.eql(1);
26-
expect(err2, 'should not error on select').to.not.be.instanceof(Error);
27-
expect(result2.length, 'should have one result').to.be.equal(1);
28-
});
29-
});
30-
});
31-
});
32-
});
33-
});
1+
const should = require('chai').should();
2+
const expect = require('chai').expect;
3+
const settings = require('../configs').mssql;
4+
5+
const check = (done, f) => {
6+
try {
7+
f();
8+
done();
9+
} catch(e) {
10+
done(e);
11+
}
12+
};
13+
14+
const QueryBuilder = require('../../index.js');
15+
const pool = new QueryBuilder(settings, 'mssql', 'pool');
16+
17+
describe('MSSQL: Multiple Queries', () => {
18+
it('should not get confused about table after deleting records', done => {
19+
pool.get_connection(qb => {
20+
qb.limit(1).delete('cities', (err, result) => {
21+
qb.select(['city', 'state_code']).from('cities').limit(1).get((err2, result2) => {
22+
qb.release();
23+
check(done, () => {
24+
expect(err, 'should not error on delete').to.not.be.instanceof(Error);
25+
expect(result.affected_rows, 'one record should be deleted').to.be.eql(1);
26+
expect(err2, 'should not error on select').to.not.be.instanceof(Error);
27+
expect(result2.length, 'should have one result').to.be.equal(1);
28+
});
29+
});
30+
});
31+
});
32+
});
33+
});

test/mysql/00-AA-tests-general.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const should = require('chai').should();
2-
3-
describe('MySQL: QueryBuilder', () => {
4-
it('actually exists and can be initialized', () => {
5-
const QueryBuilder = require('../../drivers/mysql/query_builder.js');
6-
const qb = new QueryBuilder();
7-
qb.should.be.instanceOf(QueryBuilder);
8-
});
9-
});
1+
const should = require('chai').should();
2+
3+
describe('MySQL: QueryBuilder', () => {
4+
it('actually exists and can be initialized', () => {
5+
const QueryBuilder = require('../../drivers/mysql/query_builder.js');
6+
const qb = new QueryBuilder();
7+
qb.should.be.instanceOf(QueryBuilder);
8+
});
9+
});

0 commit comments

Comments
 (0)