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
Aurélien Vermylen
jio
Commits
827c3555
Commit
827c3555
authored
Jul 23, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indexstorage tests updated
parent
2bf923bf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
158 additions
and
65 deletions
+158
-65
test/jiotests.js
test/jiotests.js
+158
-65
No files found.
test/jiotests.js
View file @
827c3555
...
@@ -4468,6 +4468,17 @@ test ("Post", function () {
...
@@ -4468,6 +4468,17 @@ test ("Post", function () {
}
}
});
});
o
.
getAttachmentCallback
=
function
(
err
,
response
)
{
if
(
response
)
{
try
{
response
=
JSON
.
parse
(
response
);
}
catch
(
e
)
{
response
=
"
PARSE ERROR
"
+
response
;
}
}
o
.
f
(
err
,
response
);
};
// post without id
// post without id
o
.
spy
(
o
,
"
jobstatus
"
,
"
done
"
,
"
Post without id
"
);
o
.
spy
(
o
,
"
jobstatus
"
,
"
done
"
,
"
Post without id
"
);
o
.
jio
.
post
({},
function
(
err
,
response
)
{
o
.
jio
.
post
({},
function
(
err
,
response
)
{
...
@@ -4485,7 +4496,6 @@ test ("Post", function () {
...
@@ -4485,7 +4496,6 @@ test ("Post", function () {
// check document
// check document
o
.
fakeIndexA
=
{
o
.
fakeIndexA
=
{
"
_id
"
:
"
A
"
,
"
indexing
"
:
[
"
title
"
],
"
indexing
"
:
[
"
title
"
],
"
free
"
:
[],
"
free
"
:
[],
"
location
"
:
{
"
location
"
:
{
...
@@ -4496,11 +4506,13 @@ test ("Post", function () {
...
@@ -4496,11 +4506,13 @@ test ("Post", function () {
]
]
};
};
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
fakeIndexB
=
{
o
.
fakeIndexB
=
{
"
_id
"
:
"
B
"
,
"
indexing
"
:
[
"
title
"
,
"
year
"
],
"
indexing
"
:
[
"
title
"
,
"
year
"
],
"
free
"
:
[],
"
free
"
:
[],
"
location
"
:
{
"
location
"
:
{
...
@@ -4511,7 +4523,10 @@ test ("Post", function () {
...
@@ -4511,7 +4523,10 @@ test ("Post", function () {
]
]
};
};
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
B
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
B
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
// post with escapable characters
// post with escapable characters
...
@@ -4551,6 +4566,17 @@ test ("Put", function(){
...
@@ -4551,6 +4566,17 @@ test ("Put", function(){
}
}
});
});
o
.
getAttachmentCallback
=
function
(
err
,
response
)
{
if
(
response
)
{
try
{
response
=
JSON
.
parse
(
response
);
}
catch
(
e
)
{
response
=
"
PARSE ERROR
"
+
response
;
}
}
o
.
f
(
err
,
response
);
};
// put without id
// put without id
// error 20 -> document id required
// error 20 -> document id required
o
.
spy
(
o
,
"
status
"
,
20
,
"
Put without id
"
);
o
.
spy
(
o
,
"
status
"
,
20
,
"
Put without id
"
);
...
@@ -4565,7 +4591,6 @@ test ("Put", function(){
...
@@ -4565,7 +4591,6 @@ test ("Put", function(){
// check index file
// check index file
o
.
fakeIndexA
=
{
o
.
fakeIndexA
=
{
"
_id
"
:
"
A
"
,
"
indexing
"
:
[
"
author
"
],
"
indexing
"
:
[
"
author
"
],
"
free
"
:
[],
"
free
"
:
[],
"
location
"
:
{
"
location
"
:
{
...
@@ -4574,18 +4599,23 @@ test ("Put", function(){
...
@@ -4574,18 +4599,23 @@ test ("Put", function(){
"
database
"
:
[{
"
_id
"
:
"
put1
"
,
"
author
"
:
"
John Doe
"
}]
"
database
"
:
[{
"
_id
"
:
"
put1
"
,
"
author
"
:
"
John Doe
"
}]
};
};
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
fakeIndexB
=
{
o
.
fakeIndexB
=
{
"
_id
"
:
"
B
"
,
"
indexing
"
:
[
"
year
"
],
"
indexing
"
:
[
"
year
"
],
"
free
"
:
[],
"
free
"
:
[],
"
location
"
:
{},
"
location
"
:
{},
"
database
"
:
[]
"
database
"
:
[]
};
};
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
B
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
B
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
// modify document - modify keyword on index!
// modify document - modify keyword on index!
...
@@ -4597,7 +4627,10 @@ test ("Put", function(){
...
@@ -4597,7 +4627,10 @@ test ("Put", function(){
// check index file
// check index file
o
.
fakeIndexA
.
database
[
0
].
author
=
"
Jane Doe
"
;
o
.
fakeIndexA
.
database
[
0
].
author
=
"
Jane Doe
"
;
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
// add new document with same keyword!
// add new document with same keyword!
...
@@ -4611,7 +4644,10 @@ test ("Put", function(){
...
@@ -4611,7 +4644,10 @@ test ("Put", function(){
o
.
fakeIndexA
.
location
.
new_doc
=
1
;
o
.
fakeIndexA
.
location
.
new_doc
=
1
;
o
.
fakeIndexA
.
database
.
push
({
"
_id
"
:
"
new_doc
"
,
"
author
"
:
"
Jane Doe
"
});
o
.
fakeIndexA
.
database
.
push
({
"
_id
"
:
"
new_doc
"
,
"
author
"
:
"
Jane Doe
"
});
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
// add second keyword to index file
// add second keyword to index file
...
@@ -4624,13 +4660,19 @@ test ("Put", function(){
...
@@ -4624,13 +4660,19 @@ test ("Put", function(){
// check index file
// check index file
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
fakeIndexB
.
location
.
put1
=
0
;
o
.
fakeIndexB
.
location
.
put1
=
0
;
o
.
fakeIndexB
.
database
.
push
({
"
_id
"
:
"
put1
"
,
"
year
"
:
"
1912
"
});
o
.
fakeIndexB
.
database
.
push
({
"
_id
"
:
"
put1
"
,
"
year
"
:
"
1912
"
});
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
B
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
B
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
// remove a keyword from an existing document
// remove a keyword from an existing document
...
@@ -4645,7 +4687,10 @@ test ("Put", function(){
...
@@ -4645,7 +4687,10 @@ test ("Put", function(){
o
.
fakeIndexA
.
database
[
1
]
=
null
;
o
.
fakeIndexA
.
database
[
1
]
=
null
;
o
.
fakeIndexA
.
free
.
push
(
1
);
o
.
fakeIndexA
.
free
.
push
(
1
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
jio
.
stop
();
o
.
jio
.
stop
();
...
@@ -4666,14 +4711,27 @@ test("Check & Repair", function () {
...
@@ -4666,14 +4711,27 @@ test("Check & Repair", function () {
}
}
});
});
o
.
getAttachmentCallback
=
function
(
err
,
response
)
{
if
(
response
)
{
try
{
response
=
JSON
.
parse
(
response
);
}
catch
(
e
)
{
response
=
"
PARSE ERROR
"
+
response
;
}
delete
response
.
location
;
response
.
database
.
sort
(
function
(
a
,
b
)
{
return
a
.
_id
<
b
.
_id
?
-
1
:
a
.
_id
>
b
.
_id
?
1
:
0
;
});
}
o
.
f
(
err
,
response
);
};
o
.
fakeIndexA
=
{
o
.
fakeIndexA
=
{
"
_id
"
:
"
A
"
,
"
indexing
"
:
[
"
director
"
],
"
indexing
"
:
[
"
director
"
],
"
free
"
:
[],
"
free
"
:
[],
"
database
"
:
[]
"
database
"
:
[]
};
};
o
.
fakeIndexB
=
{
o
.
fakeIndexB
=
{
"
_id
"
:
"
B
"
,
"
indexing
"
:
[
"
year
"
],
"
indexing
"
:
[
"
year
"
],
"
free
"
:
[],
"
free
"
:
[],
"
database
"
:
[]
"
database
"
:
[]
...
@@ -4721,27 +4779,17 @@ test("Check & Repair", function () {
...
@@ -4721,27 +4779,17 @@ test("Check & Repair", function () {
// check index file
// check index file
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Manually check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Manually check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
function
(
err
,
response
)
{
o
.
jio
.
getAttachment
({
if
(
response
)
{
"
_id
"
:
"
A
"
,
delete
response
.
location
;
"
_attachment
"
:
"
body
"
response
.
database
.
sort
(
function
(
a
,
b
)
{
},
o
.
getAttachmentCallback
);
return
a
.
_id
<
b
.
_id
?
-
1
:
a
.
_id
>
b
.
_id
?
1
:
0
;
});
}
o
.
f
(
err
,
response
);
});
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Manually check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Manually check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
B
"
},
function
(
err
,
response
)
{
o
.
jio
.
getAttachment
({
if
(
response
)
{
"
_id
"
:
"
B
"
,
delete
response
.
location
;
"
_attachment
"
:
"
body
"
response
.
database
.
sort
(
function
(
a
,
b
)
{
},
o
.
getAttachmentCallback
);
return
a
.
_id
<
b
.
_id
?
-
1
:
a
.
_id
>
b
.
_id
?
1
:
0
;
});
}
o
.
f
(
err
,
response
);
});
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
jio2
=
JIO
.
newJio
({
"
type
"
:
"
local
"
,
"
username
"
:
"
indexstoragerepair
"
});
o
.
jio2
=
JIO
.
newJio
({
"
type
"
:
"
local
"
,
"
username
"
:
"
indexstoragerepair
"
});
...
@@ -4767,27 +4815,17 @@ test("Check & Repair", function () {
...
@@ -4767,27 +4815,17 @@ test("Check & Repair", function () {
// check index file
// check index file
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Manually check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Manually check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
function
(
err
,
response
)
{
o
.
jio
.
getAttachment
({
if
(
response
)
{
"
_id
"
:
"
A
"
,
delete
response
.
location
;
"
_attachment
"
:
"
body
"
response
.
database
.
sort
(
function
(
a
,
b
)
{
},
o
.
getAttachmentCallback
);
return
a
.
_id
<
b
.
_id
?
-
1
:
a
.
_id
>
b
.
_id
?
1
:
0
;
});
}
o
.
f
(
err
,
response
);
});
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Manually check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Manually check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
B
"
},
function
(
err
,
response
)
{
o
.
jio
.
getAttachment
({
if
(
response
)
{
"
_id
"
:
"
B
"
,
delete
response
.
location
;
"
_attachment
"
:
"
body
"
response
.
database
.
sort
(
function
(
a
,
b
)
{
},
o
.
getAttachmentCallback
);
return
a
.
_id
<
b
.
_id
?
-
1
:
a
.
_id
>
b
.
_id
?
1
:
0
;
});
}
o
.
f
(
err
,
response
);
});
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
jio
.
stop
();
o
.
jio
.
stop
();
...
@@ -4992,6 +5030,17 @@ test ("Remove", function(){
...
@@ -4992,6 +5030,17 @@ test ("Remove", function(){
}
}
});
});
o
.
getAttachmentCallback
=
function
(
err
,
response
)
{
if
(
response
)
{
try
{
response
=
JSON
.
parse
(
response
);
}
catch
(
e
)
{
response
=
"
PARSE ERROR
"
+
response
;
}
}
o
.
f
(
err
,
response
);
};
// remove inexistent document
// remove inexistent document
o
.
spy
(
o
,
"
status
"
,
404
,
"
Remove inexistent document
"
);
o
.
spy
(
o
,
"
status
"
,
404
,
"
Remove inexistent document
"
);
o
.
jio
.
remove
({
"
_id
"
:
"
remove1
"
},
o
.
f
);
o
.
jio
.
remove
({
"
_id
"
:
"
remove1
"
},
o
.
f
);
...
@@ -5021,7 +5070,6 @@ test ("Remove", function(){
...
@@ -5021,7 +5070,6 @@ test ("Remove", function(){
// check index
// check index
o
.
fakeIndexA
=
{
o
.
fakeIndexA
=
{
"
_id
"
:
"
A
"
,
"
indexing
"
:
[
"
author
"
],
"
indexing
"
:
[
"
author
"
],
"
free
"
:
[
0
],
"
free
"
:
[
0
],
"
location
"
:
{
"
location
"
:
{
...
@@ -5030,11 +5078,13 @@ test ("Remove", function(){
...
@@ -5030,11 +5078,13 @@ test ("Remove", function(){
"
database
"
:
[
null
,
{
"
_id
"
:
"
removeAlso
"
,
"
author
"
:
"
Martin Mustermann
"
}]
"
database
"
:
[
null
,
{
"
_id
"
:
"
removeAlso
"
,
"
author
"
:
"
Martin Mustermann
"
}]
};
};
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
fakeIndexB
=
{
o
.
fakeIndexB
=
{
"
_id
"
:
"
B
"
,
"
indexing
"
:
[
"
year
"
],
"
indexing
"
:
[
"
year
"
],
"
free
"
:
[
0
],
"
free
"
:
[
0
],
"
location
"
:
{
"
location
"
:
{
...
@@ -5043,7 +5093,10 @@ test ("Remove", function(){
...
@@ -5043,7 +5093,10 @@ test ("Remove", function(){
"
database
"
:
[
null
,
{
"
_id
"
:
"
removeAlso
"
,
"
year
"
:
"
2525
"
}]
"
database
"
:
[
null
,
{
"
_id
"
:
"
removeAlso
"
,
"
year
"
:
"
2525
"
}]
};
};
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
B
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
B
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
// check document
// check document
...
@@ -5087,14 +5140,20 @@ test ("Remove", function(){
...
@@ -5087,14 +5140,20 @@ test ("Remove", function(){
o
.
fakeIndexA
.
location
.
remove3
=
0
;
o
.
fakeIndexA
.
location
.
remove3
=
0
;
o
.
fakeIndexA
.
database
[
0
]
=
{
"
_id
"
:
"
remove3
"
,
"
author
"
:
"
Mrs Sunshine
"
};
o
.
fakeIndexA
.
database
[
0
]
=
{
"
_id
"
:
"
remove3
"
,
"
author
"
:
"
Mrs Sunshine
"
};
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
fakeIndexB
.
free
=
[];
o
.
fakeIndexB
.
free
=
[];
o
.
fakeIndexB
.
location
.
remove3
=
0
;
o
.
fakeIndexB
.
location
.
remove3
=
0
;
o
.
fakeIndexB
.
database
[
0
]
=
{
"
_id
"
:
"
remove3
"
,
"
year
"
:
"
1234
"
};
o
.
fakeIndexB
.
database
[
0
]
=
{
"
_id
"
:
"
remove3
"
,
"
year
"
:
"
1234
"
};
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
B
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
B
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
// remove document and attachment together
// remove document and attachment together
...
@@ -5108,14 +5167,20 @@ test ("Remove", function(){
...
@@ -5108,14 +5167,20 @@ test ("Remove", function(){
delete
o
.
fakeIndexA
.
location
.
remove3
;
delete
o
.
fakeIndexA
.
location
.
remove3
;
o
.
fakeIndexA
.
database
[
0
]
=
null
;
o
.
fakeIndexA
.
database
[
0
]
=
null
;
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
fakeIndexB
.
free
=
[
0
];
o
.
fakeIndexB
.
free
=
[
0
];
delete
o
.
fakeIndexB
.
location
.
remove3
;
delete
o
.
fakeIndexB
.
location
.
remove3
;
o
.
fakeIndexB
.
database
[
0
]
=
null
;
o
.
fakeIndexB
.
database
[
0
]
=
null
;
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
B
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
B
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
// check attachment
// check attachment
...
@@ -5148,6 +5213,17 @@ test ("AllDocs", function () {
...
@@ -5148,6 +5213,17 @@ test ("AllDocs", function () {
}
}
});
});
o
.
getAttachmentCallback
=
function
(
err
,
response
)
{
if
(
response
)
{
try
{
response
=
JSON
.
parse
(
response
);
}
catch
(
e
)
{
response
=
"
PARSE ERROR
"
+
response
;
}
}
o
.
f
(
err
,
response
);
};
// adding documents
// adding documents
o
.
all1
=
{
"
_id
"
:
"
dragon.doc
"
,
o
.
all1
=
{
"
_id
"
:
"
dragon.doc
"
,
"
title
"
:
"
some title
"
,
"
author
"
:
"
Dr. No
"
,
"
year
"
:
"
1968
"
"
title
"
:
"
some title
"
,
"
author
"
:
"
Dr. No
"
,
"
year
"
:
"
1968
"
...
@@ -5176,7 +5252,6 @@ test ("AllDocs", function () {
...
@@ -5176,7 +5252,6 @@ test ("AllDocs", function () {
// check index
// check index
o
.
fakeIndexA
=
{
o
.
fakeIndexA
=
{
"
_id
"
:
"
A
"
,
"
indexing
"
:
[
"
author
"
],
"
indexing
"
:
[
"
author
"
],
"
free
"
:
[],
"
free
"
:
[],
"
location
"
:
{
"
location
"
:
{
...
@@ -5193,7 +5268,10 @@ test ("AllDocs", function () {
...
@@ -5193,7 +5268,10 @@ test ("AllDocs", function () {
]
]
};
};
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
thisShouldBeTheAnswer
=
{
o
.
thisShouldBeTheAnswer
=
{
...
@@ -5230,6 +5308,17 @@ test ("AllDocs Complex Queries", function () {
...
@@ -5230,6 +5308,17 @@ test ("AllDocs Complex Queries", function () {
});
});
o
.
localpath
=
"
jio/localstorage/icomplex/acomplex
"
;
o
.
localpath
=
"
jio/localstorage/icomplex/acomplex
"
;
o
.
getAttachmentCallback
=
function
(
err
,
response
)
{
if
(
response
)
{
try
{
response
=
JSON
.
parse
(
response
);
}
catch
(
e
)
{
response
=
"
PARSE ERROR
"
+
response
;
}
}
o
.
f
(
err
,
response
);
};
// sample data
// sample data
o
.
titles
=
[
"
Shawshank Redemption
"
,
"
Godfather
"
,
"
Godfather 2
"
,
o
.
titles
=
[
"
Shawshank Redemption
"
,
"
Godfather
"
,
"
Godfather 2
"
,
"
Pulp Fiction
"
,
"
The Good, The Bad and The Ugly
"
,
"
12 Angry Men
"
,
"
Pulp Fiction
"
,
"
The Good, The Bad and The Ugly
"
,
"
12 Angry Men
"
,
...
@@ -5248,7 +5337,6 @@ test ("AllDocs Complex Queries", function () {
...
@@ -5248,7 +5337,6 @@ test ("AllDocs Complex Queries", function () {
];
];
o
.
fakeIndexA
=
{
o
.
fakeIndexA
=
{
"
_id
"
:
"
A
"
,
"
indexing
"
:
[
"
director
"
],
"
indexing
"
:
[
"
director
"
],
"
free
"
:
[],
"
free
"
:
[],
"
location
"
:
{},
"
location
"
:
{},
...
@@ -5256,7 +5344,6 @@ test ("AllDocs Complex Queries", function () {
...
@@ -5256,7 +5344,6 @@ test ("AllDocs Complex Queries", function () {
};
};
o
.
fakeIndexB
=
{
o
.
fakeIndexB
=
{
"
_id
"
:
"
B
"
,
"
indexing
"
:
[
"
title
"
,
"
year
"
],
"
indexing
"
:
[
"
title
"
,
"
year
"
],
"
free
"
:
[],
"
free
"
:
[],
"
location
"
:
{},
"
location
"
:
{},
...
@@ -5289,11 +5376,17 @@ test ("AllDocs Complex Queries", function () {
...
@@ -5289,11 +5376,17 @@ test ("AllDocs Complex Queries", function () {
// check index file
// check index file
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexA
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
A
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
A
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
spy
(
o
,
"
value
"
,
o
.
fakeIndexB
,
"
Check index file
"
);
o
.
jio
.
get
({
"
_id
"
:
"
B
"
},
o
.
f
);
o
.
jio
.
getAttachment
({
"
_id
"
:
"
B
"
,
"
_attachment
"
:
"
body
"
},
o
.
getAttachmentCallback
);
o
.
tick
(
o
);
o
.
tick
(
o
);
// response
// response
...
...
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