Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
lucas.parsy
jio
Commits
be4a9db1
Commit
be4a9db1
authored
Oct 30, 2015
by
lucas.parsy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored gdrivestorage.js
Improved gdrive allDocs test to check return value.
parent
352ee4fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
6 deletions
+44
-6
src/jio.storage/gdrivestorage.js
src/jio.storage/gdrivestorage.js
+3
-3
test/jio.storage/gdrivestorage.tests.js
test/jio.storage/gdrivestorage.tests.js
+41
-3
No files found.
src/jio.storage/gdrivestorage.js
View file @
be4a9db1
...
...
@@ -10,7 +10,7 @@
/*global jIO, Blob, RSVP, UriTemplate, JSON*/
/*jslint nomen: true*/
(
function
(
jIO
,
Blob
,
RSVP
,
UriTemplate
)
{
(
function
(
jIO
,
Blob
,
RSVP
,
UriTemplate
,
JSON
)
{
"
use strict
"
;
var
UPLOAD_URL
=
"
https://www.googleapis.com{/upload}/drive/v2/files{/id}
"
+
...
...
@@ -64,7 +64,7 @@
}
result
.
nextPageToken
=
obj
.
nextPageToken
;
return
result
;
},
function
(
error
)
{
handleError
(
error
);
}
);
},
handleError
);
}
function
checkName
(
name
)
{
...
...
@@ -227,4 +227,4 @@
jIO
.
addStorage
(
'
gdrive
'
,
GdriveStorage
);
}(
jIO
,
Blob
,
RSVP
,
UriTemplate
));
}(
jIO
,
Blob
,
RSVP
,
UriTemplate
,
JSON
));
test/jio.storage/gdrivestorage.tests.js
View file @
be4a9db1
...
...
@@ -357,20 +357,58 @@
});
test
(
"
get all docs
"
,
function
()
{
var
objectResult
=
{
"
data
"
:
{
"
rows
"
:
[],
"
total_rows
"
:
6
}},
server
=
this
.
server
;
objectResult
.
data
.
rows
.
push
(
{
"
id
"
:
"
0B4kh3jbjOf5Lb2theE8xWHhvWXM
"
,
"
title
"
:
"
attach1
"
,
"
mimeType
"
:
"
text/plain
"
,
"
parents
"
:
[{
"
id
"
:
"
0B4kh3jbjOf5LN0Y2V0ZJS0VxS00
"
,
"
isRoot
"
:
false
}],
"
value
"
:
{}}
);
objectResult
.
data
.
rows
.
push
(
{
"
id
"
:
"
0B4kh3jbjOf5LamRlX21MZlVCYXM
"
,
"
title
"
:
"
file2
"
,
"
mimeType
"
:
"
text/plain
"
,
"
parents
"
:
[{
"
id
"
:
"
0AIkh3jbjOf5LUk9PVA
"
,
"
isRoot
"
:
true
}],
"
value
"
:
{}}
);
objectResult
.
data
.
rows
.
push
(
{
"
id
"
:
"
0B4kh3jbjOf5LTVlUWVVROWlBZzg
"
,
"
title
"
:
"
file1
"
,
"
mimeType
"
:
"
text/plain
"
,
"
parents
"
:
[{
"
id
"
:
"
0AIkh3jbjOf5LUk9PVA
"
,
"
isRoot
"
:
true
}],
"
value
"
:
{}}
);
objectResult
.
data
.
rows
.
push
(
{
"
id
"
:
"
0B4kh3jbjOf5LYTRaaV9YUkJ4a0U
"
,
"
title
"
:
"
folder2
"
,
"
mimeType
"
:
"
application/vnd.google-apps.folder
"
,
"
parents
"
:
[{
"
id
"
:
"
0AIkh3jbjOf5LUk9PVA
"
,
"
isRoot
"
:
true
}],
"
value
"
:
{}}
);
objectResult
.
data
.
rows
.
push
(
{
"
id
"
:
"
0B4kh3jbjOf5LN0Y2V0ZJS0VxS00
"
,
"
title
"
:
"
folder1
"
,
"
mimeType
"
:
"
application/vnd.google-apps.folder
"
,
"
parents
"
:
[{
"
id
"
:
"
0AIkh3jbjOf5LUk9PVA
"
,
"
isRoot
"
:
true
}],
"
value
"
:
{}}
);
objectResult
.
data
.
rows
.
push
(
{
"
id
"
:
"
0B4kh3jbjOf5Lc3RhcnRlcl9maWxl
"
,
"
title
"
:
"
How to get started with Drive
"
,
"
mimeType
"
:
"
application/pdf
"
,
"
parents
"
:
[{
"
id
"
:
"
0AIkh3jbjOf5LUk9PVA
"
,
"
isRoot
"
:
true
}],
"
value
"
:
{}}
);
this
.
server
.
respondWith
(
"
GET
"
,
listUrl
,
[
200
,
{
},
sampleList
]);
stop
();
expect
(
6
);
var
server
=
this
.
server
;
expect
(
7
);
this
.
jio
.
allDocs
()
.
then
(
function
()
{
.
then
(
function
(
res
)
{
equal
(
server
.
requests
.
length
,
1
);
equal
(
server
.
requests
[
0
].
method
,
"
GET
"
);
equal
(
server
.
requests
[
0
].
url
,
listUrl
);
equal
(
server
.
requests
[
0
].
status
,
200
);
equal
(
server
.
requests
[
0
].
requestBody
,
undefined
);
equal
(
server
.
requests
[
0
].
responseText
,
sampleList
);
deepEqual
(
res
,
objectResult
);
})
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
...
...
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