Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dotenv from 'dotenv'
import { randomBytes } from 'crypto'
import { sortBy, isEqual } from 'lodash'
import ormjs from './index'
import moment from 'moment'

Expand Down Expand Up @@ -86,7 +87,9 @@ test('make sure all documents have createdAt field', async () => {

test('make sure all documents have updatedAt field', async () => {
const post = await Post.findOne({
body: username
where: {
body: username
}
})

post.body = 'Updated!'
Expand All @@ -103,3 +106,14 @@ test('use aql query', async () => {
const users = await cursor.all()
expect(users.length).toBe(10)
})

test('check list is sorted', async () => {
const posts = await Post.find({
sort: 'post.createdAt asc',
limit: 100
})

const sorted = await sortBy(posts, ['createdAt'])

expect(isEqual(posts, sorted)).toBe(true)
})