@@ -17,7 +17,7 @@ describe("App Searching", function() {
1717 describe ( '#AV.SearchQuery' , function ( ) {
1818 this . timeout ( 10000 ) ;
1919 it ( 'should find something.' , function ( done ) {
20- var q = new AV . SearchQuery ( 'Thread ' ) ;
20+ var q = new AV . SearchQuery ( 'GameScore ' ) ;
2121 q . queryString ( '*' ) ;
2222 q . find ( ) . then ( function ( results ) {
2323 expect ( q . hits ( ) ) . to . be . greaterThan ( 0 ) ;
@@ -26,27 +26,27 @@ describe("App Searching", function() {
2626 } ) ;
2727 } ) ;
2828
29- it ( 'should sort by tid .' , function ( done ) {
30- var q = new AV . SearchQuery ( 'Ticket ' ) ;
31- q . descending ( 'tid ' ) ;
29+ it ( 'should sort by score .' , function ( done ) {
30+ var q = new AV . SearchQuery ( 'GameScore ' ) ;
31+ q . descending ( 'score ' ) ;
3232 q . queryString ( '*' ) ;
3333 q . find ( ) . then ( function ( results ) {
3434 expect ( q . hits ( ) ) . to . be . greaterThan ( 0 ) ;
3535 console . dir ( results ) ;
3636 expect ( results [ 0 ] . appURL ) . to . be . ok ( ) ;
37- expect ( results [ 0 ] . get ( 'tid' ) ) . to . be . greaterThan ( results [ 1 ] . get ( 'tid' ) ) ;
37+ expect ( results [ 0 ] . get ( 'score' ) >= results [ 1 ] . get ( 'score' ) ) . to . be . ok ( ) ;
3838 done ( ) ;
3939 } ) ;
4040 } ) ;
4141
42- it ( 'should sort by tid with sort builder.' , function ( done ) {
43- var q = new AV . SearchQuery ( 'Ticket ' ) ;
44- q . sortBy ( new AV . SearchSortBuilder ( ) . descending ( 'tid ' ) ) ;
42+ it ( 'should sort by score with sort builder.' , function ( done ) {
43+ var q = new AV . SearchQuery ( 'GameScore ' ) ;
44+ q . sortBy ( new AV . SearchSortBuilder ( ) . descending ( 'score ' ) ) ;
4545 q . queryString ( '*' ) ;
4646 q . find ( ) . then ( function ( results ) {
4747 expect ( q . hits ( ) ) . to . be . greaterThan ( 0 ) ;
4848 console . dir ( results ) ;
49- expect ( results [ 0 ] . get ( 'tid' ) ) . to . be . greaterThan ( results [ 1 ] . get ( 'tid' ) ) ;
49+ expect ( results [ 0 ] . get ( 'score' ) >= results [ 1 ] . get ( 'score' ) ) . to . be . ok ( ) ;
5050 done ( ) ;
5151 } ) ;
5252 } ) ;
0 commit comments