mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-01-25 14:42:47 +00:00
Model添加子查询的单元测试
This commit is contained in:
parent
0a29cb0bbf
commit
4508abbee3
@ -1470,6 +1470,18 @@ describe('Model', function(){
|
||||
})
|
||||
})
|
||||
|
||||
describe('child select', function(){
|
||||
it('cate lastest', function(done){
|
||||
var instance = D('Pic1');
|
||||
return instance.order('id DESC').buildSql().then(function(sql){
|
||||
return instance.table(sql, true).alias('tmp').group('group_id').order('id DESC').select().then(function(){
|
||||
var sql = instance.getLastSql().trim();
|
||||
assert.equal(sql, "SELECT * FROM ( SELECT * FROM `think_pic1` ORDER BY id DESC ) AS tmp GROUP BY `group_id` ORDER BY id DESC");
|
||||
done();
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
});
|
||||
describe('after', function(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user