node-querybuilder
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "node-querybuilder", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"author": "Kyle Farris <kyle@chomponllc.com>", | ||
@@ -5,0 +5,0 @@ "description": "Modeled after Codeigniter's QueryBuilder. Build and execute queries in a safe and database-agnostic way.", |
@@ -139,3 +139,3 @@ const should = require('chai').should(); | ||
}); | ||
it('should not allow subqueries or functions with commas in them without the second parameter being false', () => { | ||
it('should not allow subqueries without the second parameter being false', () => { | ||
qb.reset_query(); | ||
@@ -147,5 +147,27 @@ expect( | ||
expect( | ||
() => qb.select('s.star_systems, (select count(p.*) as count from planets p where p.star_system_id IN(2,3,5)) as num_planets',false) | ||
() => qb.select('s.star_systems, (select count(p.*) as count from planets p where p.star_system_id = 42) as num_planets') | ||
).to.throw(Error); | ||
expect( | ||
() => qb.select('s.star_systems, (select count(p.*) as count from planets p where p.star_system_id IN(2,3,5)) as num_planets', false) | ||
).to.not.throw(Error); | ||
}); | ||
it('should not allow functions without the second paramter being false', () => { | ||
expect( | ||
() => qb.select('s.star_systems, count(planets) as num_planets') | ||
).to.throw(Error); | ||
expect( | ||
() => qb.select('s.star_systems, if(num_planets > 0, true, false) as has_planets') | ||
).to.throw(Error); | ||
expect( | ||
() => qb.select('s.star_systems, count(planets) as num_planets', false) | ||
).to.not.throw(Error); | ||
expect( | ||
() => qb.select('s.star_systems, if(num_planets > 0, true, false) as has_planets', false) | ||
).to.not.throw(Error); | ||
}); | ||
it('should allow for functions and subqueries in statement without escaping them (aliases at the end will still be escaped)', () => { | ||
@@ -186,2 +208,2 @@ qb.reset_query(); | ||
}); | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
882634
4635
1985
0