Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
level-test-*
.nyc_output/
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ node_js:
- 6
- 8
- 10

after_success: npm run coverage
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
![Node version](https://img.shields.io/node/v/level-packager.svg)
[![Build Status](https://secure.travis-ci.org/Level/packager.png)](http://travis-ci.org/Level/packager)
[![dependencies](https://david-dm.org/Level/packager.svg)](https://david-dm.org/level/packager)
[![Coverage Status](https://coveralls.io/repos/github/Level/packager/badge.svg)](https://coveralls.io/github/Level/packager)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![npm](https://img.shields.io/npm/dm/level-packager.svg)](https://www.npmjs.com/package/level-packager)

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"url": "https://github.com/Level/packager.git"
},
"scripts": {
"test": "standard && node test.js",
"test": "standard && nyc node test.js",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"remark": "remark README.md CHANGELOG.md CONTRIBUTORS.md UPGRADING.md -o"
},
"remarkConfig": {
Expand Down Expand Up @@ -38,7 +39,9 @@
},
"license": "MIT",
"devDependencies": {
"coveralls": "^3.0.2",
"level-community": "^3.0.0",
"nyc": "^12.0.2",
"remark-cli": "^5.0.0",
"remark-git-contributors": "^0.2.2",
"remark-github": "^7.0.3",
Expand Down
21 changes: 19 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test('Level constructor relays .repair if it exists', function (t) {
packager(Down).repair('location')
})

test('Level constructor, default options', function (t) {
test('Level constructor with default options', function (t) {
t.plan(3)
function Down (location) {
t.is(location, 'location', 'location is correct')
Expand All @@ -42,7 +42,24 @@ test('Level constructor, default options', function (t) {
t.is(levelup.options.valueEncoding, 'utf8')
})

test('Level constructor, custom options', function (t) {
test('Level constructor with callback', function (t) {
t.plan(4)
function Down (location) {
t.is(location, 'location', 'location is correct')
return {
open: function (opts, cb) {
t.pass('open called')
process.nextTick(cb)
}
}
}
packager(Down)('location', function (err, db) {
t.error(err)
t.ok(db, 'db set in callback')
})
})

test('Level constructor with custom options', function (t) {
t.plan(3)
var Down = function (location) {
t.is(location, 'location', 'location is correct')
Expand Down