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
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
Bryan Kaperick
jio
Commits
3598f85f
Commit
3598f85f
authored
May 30, 2018
by
Bryan Kaperick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the query test so now all test assertions run and pass.
parent
a1a1117d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
20 deletions
+22
-20
src/jio.storage/bryanstorage.js
src/jio.storage/bryanstorage.js
+8
-6
test/jio.storage/bryanstorage.tests.js
test/jio.storage/bryanstorage.tests.js
+14
-14
No files found.
src/jio.storage/bryanstorage.js
View file @
3598f85f
...
...
@@ -11,6 +11,7 @@
*/
function
BryanStorage
(
spec
)
{
//this._sub_storage = jIO.createJIO(spec.sub_storage);
this
.
_sub_storage
=
jIO
.
createJIO
({
type
:
"
query
"
,
sub_storage
:
{
...
...
@@ -27,7 +28,7 @@
sort_on
:
[[
'
_revision
'
,
'
descending
'
]]
//include_docs: true
};
return
this
.
allDocs
(
options
)
return
substorage
.
allDocs
(
options
)
// Return query results if there are any, else throw error
.
push
(
function
(
query_results
)
{
var
docs
=
query_results
.
data
.
rows
;
...
...
@@ -70,8 +71,9 @@
);
};
BryanStorage
.
prototype
.
allDocs
=
function
()
{
return
this
.
_sub_storage
.
allDocs
.
apply
(
this
.
_sub_storage
,
arguments
);
BryanStorage
.
prototype
.
allDocs
=
function
(
options
)
{
//console.log(options);
return
this
.
_sub_storage
.
allDocs
.
apply
(
this
.
_sub_storage
,
options
);
};
BryanStorage
.
prototype
.
allAttachments
=
function
()
{
...
...
@@ -134,8 +136,8 @@
BryanStorage
.
prototype
.
repair
=
function
()
{
return
this
.
_sub_storage
.
repair
.
apply
(
this
.
_sub_storage
,
arguments
);
};
BryanStorage
.
prototype
.
hasCapacity
=
function
(
name
)
{
return
this
.
_sub_storage
.
removeAttachment
.
apply
(
this
.
_sub_storage
,
name
);
BryanStorage
.
prototype
.
hasCapacity
=
function
()
{
return
this
.
_sub_storage
.
hasCapacity
.
apply
(
this
.
_sub_storage
,
arguments
);
};
BryanStorage
.
prototype
.
buildQuery
=
function
()
{
return
this
.
_sub_storage
.
buildQuery
.
apply
(
this
.
_sub_storage
,
arguments
);
...
...
test/jio.storage/bryanstorage.tests.js
View file @
3598f85f
...
...
@@ -52,7 +52,6 @@
type
:
"
bryan
"
,
sub_storage
:
{
type
:
"
memory
"
//database: "newdb4"
}
});
jio
.
put
(
"
doc1
"
,
{
...
...
@@ -84,12 +83,17 @@
type
:
"
bryan
"
,
sub_storage
:
{
type
:
"
memory
"
//database: "otherdb8"
}
});
jio
.
put
(
"
other_doc
"
,
{
jio
.
put
(
"
main_doc
"
,
{
"
title
"
:
"
rev0
"
,
"
subtitle
"
:
"
subrev0
"
})
.
push
(
function
()
{
return
jio
.
put
(
"
other_doc
"
,
{
"
attr
"
:
"
version0
"
,
"
subattr
"
:
"
subversion0
"
});
})
.
push
(
function
()
{
return
jio
.
put
(
"
other_doc
"
,
{
...
...
@@ -97,12 +101,6 @@
"
subattr
"
:
"
subversion1
"
});
})
.
push
(
function
()
{
return
jio
.
put
(
"
main_doc
"
,
{
"
title
"
:
"
rev0
"
,
"
subtitle
"
:
"
subrev0
"
});
})
.
push
(
function
()
{
return
jio
.
put
(
"
main_doc
"
,
{
"
title
"
:
"
rev1
"
,
...
...
@@ -133,8 +131,9 @@
"
_doc_id
"
:
"
other_doc
"
},
"
Retrieve other document correctly
"
);
})
.
push
(
function
()
{
return
jio
.
allDocs
({
return
jio
.
buildQuery
({
query
:
'
(_doc_id: "main_doc") AND (_revision: 0)
'
,
sort_on
:
[[
'
_revision
'
,
'
descending
'
]]
});
...
...
@@ -143,7 +142,7 @@
equal
(
result
.
length
,
1
,
"
Correct number of results returned
"
);
})
.
push
(
function
()
{
return
jio
.
allDocs
({
return
jio
.
buildQuery
({
query
:
'
(_doc_id: "main_doc") AND (_revision: 1)
'
});
})
...
...
@@ -151,7 +150,7 @@
equal
(
result
.
length
,
1
,
"
Correct number of results returned
"
);
})
.
push
(
function
()
{
return
jio
.
allDocs
({
return
jio
.
buildQuery
({
query
:
'
(_doc_id: "other_doc") AND (_revision: 0)
'
});
})
...
...
@@ -159,7 +158,7 @@
equal
(
result
.
length
,
1
,
"
Correct number of results returned
"
);
})
.
push
(
function
()
{
return
jio
.
allDocs
({
return
jio
.
buildQuery
({
query
:
''
});
})
...
...
@@ -167,6 +166,7 @@
equal
(
result
.
length
,
5
,
"
Correct number of results returned
"
);
})
.
fail
(
function
(
error
)
{
//console.log(error);
ok
(
false
,
error
);
})
.
always
(
function
()
{
...
...
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