UNPKG

560 BJavaScriptView Raw
1
2
3require('../../src/dev/test/init');
4
5var assert = require('assert');
6var _ = require('lodash');
7
8var Query = require('../../src/db/Query');
9
10describe('db.Query', function() {
11
12 class Book {
13
14 };
15 Book.schema = {
16 table: 'books',
17 primary: ['id']
18 };
19
20 //
21 describe('first', function() {
22 it('should return correct SQL', function() {
23 var first = new Query(Book).first();
24 var sql = 'SELECT `books`.* FROM `books` ORDER BY `id` ASC LIMIT ?, ?';
25 assert.equal(sql, first.query.generated.sql);
26 });
27 });
28});