Skip to content

Commit

Permalink
Tests for where() when the replacements contain a value of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
nicjansma committed Nov 2, 2011
1 parent 5b72d8b commit 2207112
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Resources/test/query.js
Expand Up @@ -121,6 +121,14 @@
q = new joli.query().select().from('view_count').where('nb_views between ? and ?', [1000]);
expect(q.getQuery()).toBe('select * from view_count where nb_views between "1000" and ?');

// check that replacements work with 0 values
q = new joli.query().select().from('view_count').where('nb_views between ? and ?', [1000, 0]);
expect(q.getQuery()).toBe('select * from view_count where nb_views between "1000" and "0"');

// check that replacements work for values after 0
q = new joli.query().select().from('view_count').where('nb_views between ? and ? and ?', [1000, 0, 2000]);
expect(q.getQuery()).toBe('select * from view_count where nb_views between "1000" and "0" and "2000"');

// check with several chained calls
q = new joli.query().select().from('human').where('last_name = ?', 'Doe').where('first_name = ?', 'John');
expect(q.getQuery()).toBe('select * from human where last_name = "Doe" and first_name = "John"');
Expand Down

0 comments on commit 2207112

Please sign in to comment.