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
Hide 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
);
...
...
@@ -143,4 +145,4 @@
jIO
.
addStorage
(
'
bryan
'
,
BryanStorage
);
}(
jIO
));
}(
jIO
));
\ No newline at end of file
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,23 +83,22 @@
type
:
"
bryan
"
,
sub_storage
:
{
type
:
"
memory
"
//database: "otherdb8"
}
});
jio
.
put
(
"
other
_doc
"
,
{
"
attr
"
:
"
version
0
"
,
"
sub
attr
"
:
"
subversion
0
"
jio
.
put
(
"
main
_doc
"
,
{
"
title
"
:
"
rev
0
"
,
"
sub
title
"
:
"
subrev
0
"
})
.
push
(
function
()
{
return
jio
.
put
(
"
other_doc
"
,
{
"
attr
"
:
"
version
1
"
,
"
subattr
"
:
"
subversion
1
"
"
attr
"
:
"
version
0
"
,
"
subattr
"
:
"
subversion
0
"
});
})
.
push
(
function
()
{
return
jio
.
put
(
"
main
_doc
"
,
{
"
title
"
:
"
rev0
"
,
"
sub
title
"
:
"
subrev0
"
return
jio
.
put
(
"
other
_doc
"
,
{
"
attr
"
:
"
version1
"
,
"
sub
attr
"
:
"
subversion1
"
});
})
.
push
(
function
()
{
...
...
@@ -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