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
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
c6e858ae
Commit
c6e858ae
authored
Sep 09, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
idb: test huge attachment
parent
0a4768d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
8 deletions
+45
-8
test/jio.storage/indexeddbstorage.tests.js
test/jio.storage/indexeddbstorage.tests.js
+45
-8
No files found.
test/jio.storage/indexeddbstorage.tests.js
View file @
c6e858ae
...
@@ -20,10 +20,10 @@
...
@@ -20,10 +20,10 @@
/*jslint nomen: true */
/*jslint nomen: true */
/*global indexedDB, Blob, sinon, IDBDatabase,
/*global indexedDB, Blob, sinon, IDBDatabase,
IDBTransaction, IDBIndex, IDBObjectStore, IDBCursor, IDBKeyRange,
IDBTransaction, IDBIndex, IDBObjectStore, IDBCursor, IDBKeyRange,
DOMException*/
DOMException
, Rusha
*/
(
function
(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
(
function
(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
IDBTransaction
,
IDBIndex
,
IDBObjectStore
,
IDBCursor
,
IDBKeyRange
,
IDBTransaction
,
IDBIndex
,
IDBObjectStore
,
IDBCursor
,
IDBKeyRange
,
DOMException
)
{
DOMException
,
Rusha
)
{
"
use strict
"
;
"
use strict
"
;
var
test
=
QUnit
.
test
,
var
test
=
QUnit
.
test
,
stop
=
QUnit
.
stop
,
stop
=
QUnit
.
stop
,
...
@@ -34,12 +34,9 @@
...
@@ -34,12 +34,9 @@
equal
=
QUnit
.
equal
,
equal
=
QUnit
.
equal
,
module
=
QUnit
.
module
,
module
=
QUnit
.
module
,
throws
=
QUnit
.
throws
,
throws
=
QUnit
.
throws
,
big_string
=
""
,
big_string
=
""
;
j
;
for
(
j
=
0
;
j
<
3000000
;
j
+=
1
)
{
big_string
=
new
Array
(
3000000
).
fill
(
'
a
'
).
join
(
''
);
big_string
+=
"
a
"
;
}
function
deleteIndexedDB
(
storage
)
{
function
deleteIndexedDB
(
storage
)
{
return
new
RSVP
.
Promise
(
function
resolver
(
resolve
,
reject
)
{
return
new
RSVP
.
Promise
(
function
resolver
(
resolve
,
reject
)
{
...
@@ -1764,6 +1761,46 @@
...
@@ -1764,6 +1761,46 @@
});
});
});
});
test
(
"
get huge attachment
"
,
function
()
{
var
context
=
this
,
attachment
=
"
attachment
"
;
stop
();
expect
(
4
);
deleteIndexedDB
(
context
.
jio
)
.
then
(
function
()
{
return
context
.
jio
.
put
(
"
foo
"
,
{
"
title
"
:
"
bar
"
});
})
.
then
(
function
()
{
return
context
.
jio
.
putAttachment
(
"
foo
"
,
attachment
,
new
Blob
([
new
Array
(
11
*
2000000
).
fill
(
'
a
'
).
join
(
''
)],
{
type
:
'
text/fooplain
'
})
);
})
.
then
(
function
()
{
return
context
.
jio
.
getAttachment
(
"
foo
"
,
attachment
);
})
.
then
(
function
(
blob
)
{
ok
(
blob
instanceof
Blob
,
"
Data is Blob
"
);
equal
(
blob
.
type
,
'
text/fooplain
'
);
equal
(
blob
.
size
,
22000000
);
return
jIO
.
util
.
readBlobAsArrayBuffer
(
blob
);
})
.
then
(
function
(
result
)
{
equal
((
new
Rusha
()).
digestFromArrayBuffer
(
result
.
target
.
result
),
'
6f510194afd8e436d00a543f49a7df09e86c2687
'
);
})
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
})
.
always
(
function
()
{
start
();
});
});
test
(
"
retrieve empty blob
"
,
function
()
{
test
(
"
retrieve empty blob
"
,
function
()
{
var
context
=
this
,
var
context
=
this
,
attachment
=
"
attachment
"
,
attachment
=
"
attachment
"
,
...
@@ -2089,4 +2126,4 @@
...
@@ -2089,4 +2126,4 @@
}(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
}(
jIO
,
QUnit
,
indexedDB
,
Blob
,
sinon
,
IDBDatabase
,
IDBTransaction
,
IDBIndex
,
IDBObjectStore
,
IDBCursor
,
IDBKeyRange
,
IDBTransaction
,
IDBIndex
,
IDBObjectStore
,
IDBCursor
,
IDBKeyRange
,
DOMException
));
DOMException
,
Rusha
));
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