@zargu/couchdb-designer
Version:
Create and testing couchdb design document form directory structure.
30 lines (27 loc) • 741 B
JavaScript
import compareAny from '../../src/util/compareAny';
describe('viewSort',() => {
test('sort',() => {
let rows = [
{key:{b:10,a:1}},
{key:{b:10}},
{key:{b:10}},
{key:{a:false, b:true}},
{key:{a:10}},
{key:{a:null}},
{key:[1,false,true]},
{key:[1,null,23]},
{key:[0,20,30]},
{key:[null,0,'zebra']},
{key:[0,20,10]},
{key:'zebra'},
{key:'alma'},
{key:10},
{key:0},
{key:true},
{key:false},
{key:null}
]
rows.sort((a,b) => compareAny(a.key, b.key));
expect(rows).toMatchSnapshot();
})
})