Skip to content

Commit 1d19508

Browse files
committed
tests
1 parent 345031a commit 1d19508

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/model.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import qs from 'qs'
12
import Post from './dummy/models/Post'
23

34
describe('Model methods', () => {
@@ -11,4 +12,18 @@ describe('Model methods', () => {
1112

1213
expect(errorModel).toThrow('The "id" must be a integer on find() method.')
1314
})
15+
16+
test('it builds a complexy query', () => {
17+
const post = Post
18+
.where('title', 'Cool')
19+
.where('status', 'ACTIVE')
20+
.include('user')
21+
.append('likes')
22+
.orderBy('created_at')
23+
24+
const query = encodeURI('?include=user&filter[title]=Cool&filter[status]=ACTIVE&append=likes&sort=created_at')
25+
26+
expect(post._builder.query()).toEqual(query)
27+
28+
})
1429
})

0 commit comments

Comments
 (0)