File: open-create-if-missing-test.js

package info (click to toggle)
node-rollup-plugin-node-polyfills 0.2.1%2Bdfsg%2B~0.11.0-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,748 kB
  • sloc: javascript: 33,166; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 772 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
exports.setUp = function (test, testCommon) {
  test('setUp', testCommon.setUp)
}

exports.createIfMissing = function (test, testCommon) {
  test('test database open createIfMissing:false', function (t) {
    var db = testCommon.factory()
    var async = false

    db.open({ createIfMissing: false }, function (err) {
      t.ok(err, 'error')
      t.ok(/does not exist/.test(err.message), 'error is about dir not existing')
      t.ok(async, 'callback is asynchronous')
      t.end()
    })

    async = true
  })
}

exports.tearDown = function (test, testCommon) {
  test('tearDown', testCommon.tearDown)
}

exports.all = function (test, testCommon) {
  exports.setUp(test, testCommon)
  exports.createIfMissing(test, testCommon)
  exports.tearDown(test, testCommon)
}