2019-08-01 12:24:01 +00:00
|
|
|
var mnt = require('./fixtures/mnt')
|
|
|
|
var tape = require('tape')
|
|
|
|
|
2019-08-06 08:55:08 +00:00
|
|
|
var Fuse = require('../')
|
|
|
|
|
2019-08-01 12:24:01 +00:00
|
|
|
tape('mount', function (t) {
|
2019-08-06 08:55:08 +00:00
|
|
|
const fuse = new Fuse(mnt, {}, { force: true })
|
|
|
|
fuse.mount(function (err) {
|
2019-08-01 12:24:01 +00:00
|
|
|
t.error(err, 'no error')
|
|
|
|
t.ok(true, 'works')
|
2019-08-06 08:55:08 +00:00
|
|
|
fuse.unmount(function () {
|
2019-08-01 12:24:01 +00:00
|
|
|
t.end()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
tape('mount + unmount + mount', function (t) {
|
2019-08-06 08:55:08 +00:00
|
|
|
const fuse1 = new Fuse(mnt, {}, { force: true, debug: false })
|
|
|
|
const fuse2 = new Fuse(mnt, {}, { force: true, debug: false })
|
|
|
|
|
|
|
|
fuse1.mount(function (err) {
|
2019-08-01 12:24:01 +00:00
|
|
|
t.error(err, 'no error')
|
|
|
|
t.ok(true, 'works')
|
2019-08-06 08:55:08 +00:00
|
|
|
fuse1.unmount(function () {
|
|
|
|
fuse2.mount(function (err) {
|
2019-08-01 12:24:01 +00:00
|
|
|
t.error(err, 'no error')
|
|
|
|
t.ok(true, 'works')
|
2019-08-06 08:55:08 +00:00
|
|
|
fuse2.unmount(function () {
|
2019-08-01 12:24:01 +00:00
|
|
|
t.end()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2019-08-07 10:55:41 +00:00
|
|
|
tape('mount + unmount + mount with same instance fails', function (t) {
|
|
|
|
const fuse = new Fuse(mnt, {}, { force: true, debug: false })
|
|
|
|
|
|
|
|
fuse.mount(function (err) {
|
|
|
|
t.error(err, 'no error')
|
|
|
|
t.ok(true, 'works')
|
|
|
|
fuse.unmount(function () {
|
|
|
|
fuse.mount(function (err) {
|
|
|
|
t.ok(err, 'had error')
|
|
|
|
t.end()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2019-08-01 12:24:01 +00:00
|
|
|
tape('mnt point must exist', function (t) {
|
2019-08-06 08:55:08 +00:00
|
|
|
const fuse = new Fuse('.does-not-exist', {}, { debug: false })
|
|
|
|
fuse.mount(function (err) {
|
2019-08-01 12:24:01 +00:00
|
|
|
t.ok(err, 'had error')
|
|
|
|
t.end()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
tape('mnt point must be directory', function (t) {
|
2019-08-06 08:55:08 +00:00
|
|
|
const fuse = new Fuse(__filename, {}, { debug: false })
|
|
|
|
fuse.mount(function (err) {
|
2019-08-01 12:24:01 +00:00
|
|
|
t.ok(err, 'had error')
|
|
|
|
t.end()
|
|
|
|
})
|
|
|
|
})
|