Debian Codegraph @

packages/search/lib/commands/index.spec.ts

raw
1 import { strict as assert } from 'assert';
2 import { pushArgumentsWithLength, pushSortByArguments } from '.';
3
4 describe('pushSortByArguments', () => {
5 describe('single', () => {
6 it('string', () => {
7 assert.deepEqual(
8 pushSortByArguments([], 'SORTBY', '@property'),
9 ['SORTBY', '1', '@property']
10 );
11 });
12
13 it('.BY', () => {
14 assert.deepEqual(
15 pushSortByArguments([], 'SORTBY', { BY: '@property' }),
16 ['SORTBY', '1', '@property']
17 );
18 });
19
20 it('with DIRECTION', () => {
21 assert.deepEqual(
22 pushSortByArguments([], 'SORTBY', {
23 BY: '@property',
24 DIRECTION: 'ASC'
25 }),
26 ['SORTBY', '2', '@property', 'ASC']
27 );
28 });
29 });
30
31 it('multiple', () => {
32 assert.deepEqual(
33 pushSortByArguments([], 'SORTBY', ['@1', '@2']),
34 ['SORTBY', '2', '@1', '@2']
35 );
36 });
37 });
38
39 it('pushArgumentsWithLength', () => {
40 assert.deepEqual(
41 pushArgumentsWithLength(['a'], args => {
42 args.push('b', 'c');
43 }),
44 ['a', '2', 'b', 'c']
45 );
46 });