Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Hardik Juneja
jio-main
Commits
168b4de2
Commit
168b4de2
authored
Dec 28, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
put method jiotest revision + local
parent
13a338f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
test/jiotests.js
test/jiotests.js
+59
-0
No files found.
test/jiotests.js
View file @
168b4de2
...
@@ -1100,6 +1100,65 @@ test ("Post", function(){
...
@@ -1100,6 +1100,65 @@ test ("Post", function(){
});
});
test
(
"
Put
"
,
function
(){
var
o
=
generateTools
(
this
);
o
.
jio
=
JIO
.
newJio
({
"
type
"
:
"
revision
"
,
"
secondstorage
"
:
{
"
type
"
:
"
local
"
,
"
username
"
:
"
urevput
"
,
"
applicationname
"
:
"
arevput
"
}
});
// put without id
// error 20 -> document id required
o
.
spy
(
o
,
"
status
"
,
20
,
"
Put without id
"
);
o
.
jio
.
put
({},
o
.
f
);
o
.
tick
(
o
);
// put non empty document
o
.
doc
=
{
"
_id
"
:
"
put1
"
,
"
title
"
:
"
myPut1
"
};
o
.
revs_info
=
[];
o
.
rev
=
"
1-
"
+
hex_sha256
(
JSON
.
stringify
(
o
.
doc
)
+
JSON
.
stringify
(
o
.
revs_info
));
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
put1
"
,
"
rev
"
:
o
.
rev
},
"
Creates a document
"
);
o
.
jio
.
put
(
o
.
doc
,
o
.
f
);
o
.
tick
(
o
);
// check document
o
.
doc
[
"
_id
"
]
=
"
put1.
"
+
o
.
rev
;
deepEqual
(
localstorage
.
getItem
(
"
jio/localstorage/urevput/arevput/put1.
"
+
o
.
rev
),
o
.
doc
,
"
Check document
"
);
// put and document already exists
o
.
spy
(
o
,
"
status
"
,
409
,
"
Update the document
"
);
o
.
jio
.
put
({
"
_id
"
:
"
put1
"
,
"
title
"
:
"
myPut2
"
},
o
.
f
);
o
.
tick
(
o
);
// post + revision
o
.
doc
=
{
"
_id
"
:
"
put1
"
,
"
_rev
"
:
o
.
rev
,
"
title
"
:
"
myPut2
"
};
o
.
revs_info
=
[{
"
rev
"
:
o
.
rev
,
"
status
"
:
"
available
"
}];
o
.
rev
=
"
2-
"
+
hex_sha256
(
JSON
.
stringify
(
o
.
doc
)
+
JSON
.
stringify
(
o
.
revs_info
));
o
.
spy
(
o
,
"
status
"
,
undefined
,
"
Put + revision
"
);
o
.
jio
.
put
(
o
.
doc
,
o
.
f
);
o
.
tick
(
o
);
// check document
o
.
doc
[
"
_id
"
]
=
"
put1.
"
+
o
.
rev
;
deepEqual
(
localstorage
.
getItem
(
"
jio/localstorage/urevput/arevput/put1.
"
+
o
.
rev
),
o
.
doc
,
"
Check document
"
);
o
.
jio
.
stop
();
});
/*
/*
module ('Jio DAVStorage');
module ('Jio DAVStorage');
...
...
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