File tree 3 files changed +22
-3
lines changed
3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ module . exports = require ( './src/client' ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " itemsapi" ,
3
- "version" : " 2.0.4 " ,
3
+ "version" : " 2.0.6 " ,
4
4
"description" : " Javascript client for ItemsAPI" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
- "test" : " echo \" Error: no test specified \" && exit 1 "
7
+ "test" : " mocha -b -- exit tests/* "
8
8
},
9
9
"repository" : {
10
10
"type" : " git" ,
Original file line number Diff line number Diff line change 1
1
const assert = require ( 'assert' ) ;
2
2
3
3
4
- const ItemsAPI = require ( '../src/client ' ) ;
4
+ const ItemsAPI = require ( '../' ) ;
5
5
const client = new ItemsAPI ( {
6
6
host : 'http://127.0.0.1:3001'
7
7
} ) ;
8
8
9
9
const index = client . getIndex ( ) ;
10
10
11
11
const config = {
12
+ sorting_fields : [ 'votes' ] ,
12
13
aggregations : {
13
14
director : {
14
15
conjunction : true
@@ -86,5 +87,21 @@ describe('search', function() {
86
87
result = await index . getItem ( 1 ) ;
87
88
assert . deepEqual ( result . name , undefined ) ;
88
89
assert . deepEqual ( result . votes , 100 ) ;
90
+
91
+
92
+ result = await index . search ( {
93
+ sort_field : 'votes' ,
94
+ order : 'asc' ,
95
+ per_page : 100
96
+ } ) ;
97
+ assert . deepEqual ( result . pagination . total , 19 ) ;
98
+ assert . deepEqual ( result . data . items . length , 19 ) ;
99
+ assert . deepEqual ( result . data . items [ 0 ] . votes , 100 ) ;
100
+
101
+ //result = await index.getItem(1);
102
+ //assert.deepEqual(result.name, 'The Shawshank Redemption');
103
+ //assert.deepEqual(result.votes, 100);
104
+ //console.log(result.data.items);
105
+
89
106
} ) ;
90
107
} ) ;
You can’t perform that action at this time.
0 commit comments