Lines 74-80
get '/dbic_merge_sorting' => sub {
Link Here
|
74 |
$attributes = $c->dbic_merge_sorting( |
74 |
$attributes = $c->dbic_merge_sorting( |
75 |
{ |
75 |
{ |
76 |
attributes => $attributes, |
76 |
attributes => $attributes, |
77 |
params => { _match => 'exact', _order_by => 'uno|-dos|+tres' } |
77 |
params => { _match => 'exact', _order_by => [ 'uno', '-dos', '+tres', ' cuatro' ] } |
78 |
} |
78 |
} |
79 |
); |
79 |
); |
80 |
$c->render( json => $attributes, status => 200 ); |
80 |
$c->render( json => $attributes, status => 200 ); |
Lines 135-147
subtest 'dbic_merge_sorting() tests' => sub {
Link Here
|
135 |
|
135 |
|
136 |
my $t = Test::Mojo->new; |
136 |
my $t = Test::Mojo->new; |
137 |
|
137 |
|
138 |
$t->get_ok('/dbic_merge_sorting') |
138 |
$t->get_ok('/dbic_merge_sorting')->status_is(200) |
139 |
->status_is(200) |
|
|
140 |
->json_is( '/a' => 'a', 'Existing values are kept (a)' ) |
139 |
->json_is( '/a' => 'a', 'Existing values are kept (a)' ) |
141 |
->json_is( '/b' => 'b', 'Existing values are kept (b)' ) |
140 |
->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is( |
142 |
->json_is( '/order_by' => [ 'uno', { -desc => 'dos' }, { -asc => 'tres' } ] ); |
141 |
'/order_by' => [ |
|
|
142 |
'uno', |
143 |
{ -desc => 'dos' }, |
144 |
{ -asc => 'tres' }, |
145 |
{ -asc => 'cuatro' } |
146 |
] |
147 |
); |
143 |
}; |
148 |
}; |
144 |
|
149 |
|
|
|
150 |
|
145 |
subtest '_build_query_params_from_api' => sub { |
151 |
subtest '_build_query_params_from_api' => sub { |
146 |
|
152 |
|
147 |
plan tests => 16; |
153 |
plan tests => 16; |
148 |
- |
|
|