Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
1631f6c5
Commit
1631f6c5
authored
Mar 14, 2019
by
preetwinder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error message change and remove unused variable
parent
9dfafb7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
src/jio.storage/indexstorage2.js
src/jio.storage/indexstorage2.js
+10
-7
test/jio.storage/indexstorage2.tests.js
test/jio.storage/indexstorage2.tests.js
+7
-5
No files found.
src/jio.storage/indexstorage2.js
View file @
1631f6c5
...
...
@@ -34,12 +34,17 @@
this
.
_sub_storage
=
jIO
.
createJIO
(
description
.
sub_storage
);
this
.
_database_name
=
"
jio:
"
+
description
.
database
;
this
.
_index_keys
=
description
.
index_keys
||
[];
this
.
_version
=
1
;
}
IndexStorage2
.
prototype
.
hasCapacity
=
function
(
name
)
{
return
((
name
===
"
list
"
)
||
(
name
===
"
query
"
))
||
(
name
===
"
limit
"
)
||
(
name
===
"
select
"
);
var
this_storage_capacity_list
=
[
"
limit
"
,
"
select
"
,
"
list
"
,
"
query
"
];
if
(
this_storage_capacity_list
.
indexOf
(
name
)
!==
-
1
)
{
return
true
;
}
};
function
checkArrayEquality
(
array1
,
array2
)
{
...
...
@@ -221,10 +226,8 @@
try
{
context
.
_sub_storage
.
hasCapacity
(
"
query
"
);
}
catch
(
error
)
{
throw
new
jIO
.
util
.
jIOError
(
"
No index for this key and substorage doesn't support queries
"
,
404
);
throw
new
jIO
.
util
.
jIOError
(
"
No index for '
"
+
index
+
"
' key and substorage doesn't support queries
"
,
404
);
}
return
context
.
_sub_storage
.
buildQuery
(
{
"
query
"
:
index
+
"
:
"
+
value
}
...
...
test/jio.storage/indexstorage2.tests.js
View file @
1631f6c5
...
...
@@ -132,6 +132,7 @@
ok
(
this
.
jio
.
hasCapacity
(
"
list
"
));
ok
(
this
.
jio
.
hasCapacity
(
"
query
"
));
ok
(
this
.
jio
.
hasCapacity
(
"
limit
"
));
ok
(
this
.
jio
.
hasCapacity
(
"
select
"
));
});
/////////////////////////////////////////////////////////////////
...
...
@@ -194,7 +195,7 @@
}
});
stop
();
expect
(
3
);
expect
(
4
);
DummyStorage3
.
prototype
.
put
=
function
(
id
,
value
)
{
equal
(
id
,
"
32
"
);
...
...
@@ -207,7 +208,8 @@
return
context
.
jio
.
allDocs
({
query
:
'
a: "3"
'
});
})
.
then
(
function
(
result
)
{
deepEqual
(
result
.
data
.
rows
[
0
],
{
"
id
"
:
"
32
"
,
"
value
"
:
{}});
equal
(
result
.
data
.
total_rows
,
1
);
deepEqual
(
result
.
data
.
rows
,
[{
"
id
"
:
"
32
"
,
"
value
"
:
{}}]);
})
.
fail
(
function
(
error
)
{
console
.
log
(
error
);
...
...
@@ -298,7 +300,7 @@
.
fail
(
function
(
error
)
{
equal
(
error
.
status_code
,
404
);
equal
(
error
.
message
,
"
No index for
this
key and substorage doesn't support queries
"
);
"
No index for
'b'
key and substorage doesn't support queries
"
);
})
.
always
(
function
()
{
start
();
...
...
@@ -731,7 +733,7 @@
});
});
test
(
"
Index keys modified
"
,
function
()
{
test
(
"
Index keys
are
modified
"
,
function
()
{
var
context
=
this
;
context
.
jio
=
jIO
.
createJIO
({
type
:
"
index2
"
,
...
...
@@ -805,7 +807,7 @@
.
fail
(
function
(
error
)
{
equal
(
error
.
status_code
,
404
);
equal
(
error
.
message
,
"
No index for
this
key and substorage doesn't support queries
"
);
"
No index for
'a'
key and substorage doesn't support queries
"
);
})
.
always
(
function
()
{
start
();
...
...
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