-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2cb80c
commit 8f73143
Showing
5 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
QUnit.module('worker'); | ||
|
||
asyncTest('create it',1,function(){ | ||
var worker = new Worker('worker.js'); | ||
worker.addEventListener('message',function(e){ | ||
ok('pong',e.data); | ||
worker.terminate(); | ||
start(); | ||
}); | ||
worker.postMessage('ping'); | ||
}); | ||
asyncTest('check pouch version',1,function(){ | ||
var worker = new Worker('worker.js'); | ||
worker.addEventListener('message',function(e){ | ||
ok(PouchDB.version,e.data); | ||
worker.terminate(); | ||
start(); | ||
}); | ||
worker.postMessage('version'); | ||
}); | ||
asyncTest('create db',1,function(){ | ||
var worker = new Worker('worker.js'); | ||
worker.addEventListener('error',function(e){ | ||
throw e; | ||
}); | ||
worker.addEventListener('message',function(e){ | ||
ok('lala',e.data); | ||
worker.terminate(); | ||
start(); | ||
}); | ||
worker.postMessage(['create',testUtils.generateAdapterUrl(adapter)]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
importScripts('../dist/pouchdb-nightly.js'); | ||
function bigTest(name){ | ||
PouchDB(name,function(err,db){ | ||
if(err){ | ||
throw err; | ||
} | ||
db.post({_id:"blablah",key:'lala'},function(err){ | ||
if(err){ | ||
throw err; | ||
} | ||
db.get('blablah',function(err,doc){ | ||
if(err){ | ||
throw err; | ||
} | ||
self.postMessage(doc.key); | ||
PouchDB.destroy(name); | ||
}); | ||
}); | ||
}); | ||
} | ||
self.addEventListener('message',function(e){ | ||
if(e.data==='ping'){ | ||
self.postMessage('pong'); | ||
} | ||
if(e.data==='version'){ | ||
self.postMessage(PouchDB.version); | ||
} | ||
if(Array.isArray(e.data)&&e.data[0]==='create'){ | ||
bigTest(e.data[1]); | ||
} | ||
}); |