Skip to content

Commit

Permalink
browser tests
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinmetcalf committed Mar 6, 2014
1 parent 2e41252 commit 9660687
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
8 changes: 6 additions & 2 deletions README.md
@@ -1,6 +1,6 @@
# LevelDB GeoStore for Terraformer

This is an experimental LevelDB plugin got Terraformer's GeoStore. Currently, it works in Node.js only.
This is an experimental LevelDB plugin got Terraformer's GeoStore. Should work in the browser with browserify.

## Install

Expand All @@ -19,4 +19,8 @@ var store = new GeoStore({
store: new LevelStore("buildings"),
index: RTree()
});
```
```

## Developing

run tests with `npm test`, it will run the node tests and then give you a url, visit that and you will see the browser tests.
6 changes: 4 additions & 2 deletions index.js
@@ -1,4 +1,5 @@
var level = require('levelup');
var levelup = require('levelup');
var leveldown = require('leveldown');
module.exports = LevelStore;
function LevelStore (options, cb) {
if (typeof options === 'string') {
Expand All @@ -22,8 +23,9 @@ function LevelStore (options, cb) {
Object.keys(options).forEach(function(key) {
levelOpts[key] = options[key];
});
levelOpts.db = levelOpts.db || leveldown;
levelOpts.valueEncoding = 'json';
this.db = level(this.name, levelOpts, cb);
this.db = levelup(this.name, levelOpts, cb);
this.close = this.db.close.bind(this.db);
}

Expand Down
18 changes: 14 additions & 4 deletions package.json
Expand Up @@ -4,17 +4,27 @@
"description": "A proof of concept leveldb geostore for Terraformer",
"main": "index.js",
"scripts": {
"test": "jshint index.js && node test.js"
"test": "jshint index.js && node test.js && npm run browser-test",
"browser-test": "browserify test.js | testling -u"
},
"repository": "git@github.com:JerrySievert/terraformer-geostore-leveldb.git",
"author": "<Jerry Sievert> code@legitimatesounding.com",
"license": "BSD",
"devDependencies": {
"jshint": "^2.4.4",
"leveldown": "~0.10.2",
"tape": "~2.10.2"
"tape": "~2.10.2",
"level-js": "git://github.com/qs44/level.js.git#qs44-pouchDB44-delete-function-in-index",
"browserify": "^3.32.0"
},
"dependencies": {
"levelup": "~0.18.2"
"leveldown": "~0.10.2",
"levelup": "~0.18.2",
"testling": "^1.6.0"
},
"browser": {
"leveldown": "level-js"
},
"testling": {
"files": "test.js"
}
}

0 comments on commit 9660687

Please sign in to comment.