Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio_mebibou
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alexandra Rogova
jio_mebibou
Commits
71e8158b
Commit
71e8158b
authored
Jun 27, 2019
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
query.js: do not raise if the sort_on_option list is empty
parent
b08e246c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
src/queries/query.js
src/queries/query.js
+3
-0
test/queries/tests.js
test/queries/tests.js
+24
-0
No files found.
src/queries/query.js
View file @
71e8158b
...
@@ -157,6 +157,9 @@
...
@@ -157,6 +157,9 @@
throw
new
TypeError
(
"
jioquery.sortOn():
"
+
throw
new
TypeError
(
"
jioquery.sortOn():
"
+
"
Argument 1 is not of type 'array'
"
);
"
Argument 1 is not of type 'array'
"
);
}
}
if
(
sort_on_option
.
length
===
0
)
{
return
list
;
}
list
.
sort
(
generateSortFunction
(
list
.
sort
(
generateSortFunction
(
key_schema
,
key_schema
,
sort_on_option
sort_on_option
...
...
test/queries/tests.js
View file @
71e8158b
...
@@ -642,6 +642,30 @@
...
@@ -642,6 +642,30 @@
});
});
});*/
});*/
test
(
'
Empty sort_on options do not raise
'
,
function
()
{
var
doc_list
=
[
{
'
a
'
:
1
},
{
'
c
'
:
3
},
{
'
b
'
:
2
}
];
stop
();
expect
(
1
);
jIO
.
QueryFactory
.
create
(
""
).
exec
(
doc_list
,
{
sort_on
:
[],
}
)
.
then
(
function
(
list
)
{
deepEqual
(
list
,
[
{
'
a
'
:
1
},
{
'
c
'
:
3
},
{
'
b
'
:
2
}
],
'
Sorting didn
\'
t raise
'
);
}).
always
(
start
);
});
test
(
'
Multiple sort_on options
'
,
function
()
{
test
(
'
Multiple sort_on options
'
,
function
()
{
var
i
,
var
i
,
len
=
1000
,
len
=
1000
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment