This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added unit test for DBSelect.orWhere() functionality.

  • Loading branch information...
kalifg committed Aug 3, 2012
1 parent ec670eb commit d7cbcfdd38d6f868fd0f7a2da400158838d32dcb
Showing with 20 additions and 0 deletions.
  1. +20 −0 test/db-select.js
View
@@ -191,6 +191,26 @@ var adapterTestSuite = function( adapterName, callback )
}
},
+
+ 'an advanced WHERE clause, with disordered from(), where() and orWhere() calls': {
+ topic: function()
+ {
+ return dbWrapper.getSelect()
+ .where('enabled=1')
+ .where( 'id=?', 10 )
+ .from('user')
+ .where( 'first_name=?', 'Dr.')
+ .where( 'last_name LIKE ?', '%Benton%' )
+ .orWhere( 'nickname=?', '"`\'éàèç' );
+ },
+
+ 'assembled Select is OK': function( select )
+ {
+ var user = dbWrapper._adapter.escapeTable('user');
+ assert.equal( select.assemble(), 'SELECT '+user+'.* FROM '+user+' WHERE enabled=1 AND id=10 AND first_name=\'Dr.\' AND last_name LIKE \'%Benton%\' OR nickname='+dbWrapper.escape('"`\'éàèç') );
+ }
+
+ },
'a "WHERE clause" only SELECT ': {
topic: function()

0 comments on commit d7cbcfd

Please sign in to comment.