This repository has been archived by the owner on Dec 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Showing
5 changed files
with
98 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
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,47 @@ | ||
var xtend = require('xtend') | ||
var hasOwnProperty = Object.prototype.hasOwnProperty | ||
|
||
module.exports = function (test, testCommon) { | ||
test('setUp common', testCommon.setUp) | ||
|
||
test('db has manifest', function (t) { | ||
var db = testCommon.factory() | ||
var supports = db.supports | ||
|
||
t.ok(isObject(supports)) | ||
t.ok(isObject(supports.additionalMethods)) | ||
|
||
for (var k in supports) { | ||
if (!hasOwnProperty.call(supports, k)) continue | ||
if (k === 'additionalMethods') continue | ||
|
||
t.is(typeof supports[k], 'boolean', k) | ||
} | ||
|
||
for (var m in supports.additionalMethods) { | ||
if (!hasOwnProperty.call(supports.additionalMethods, m)) continue | ||
t.ok(isObject(supports.additionalMethods[m]), m) | ||
} | ||
|
||
var before = xtend(supports, { | ||
additionalMethods: xtend(supports.additionalMethods) | ||
}) | ||
|
||
db.open(function (err) { | ||
t.ifError(err, 'no open error') | ||
t.same(db.supports, before, 'manifest did not change after open') | ||
|
||
db.close(function (err) { | ||
t.ifError(err, 'no close error') | ||
t.same(db.supports, before, 'manifest did not change after close') | ||
t.end() | ||
}) | ||
}) | ||
}) | ||
|
||
test('tearDown', testCommon.tearDown) | ||
} | ||
|
||
function isObject (o) { | ||
return typeof o === 'object' && o !== null | ||
} |
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