1
0
mirror of https://github.com/fuse-friends/fuse-native synced 2024-09-28 06:00:43 +00:00
fuse-friends_fuse-native/test/misc.js

67 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-11-19 13:04:46 +00:00
const mnt = require('./fixtures/mnt')
const tape = require('tape')
2019-08-01 12:24:01 +00:00
2019-11-19 13:04:46 +00:00
const Fuse = require('../')
const { unmount } = require('./helpers')
2019-08-06 08:55:08 +00:00
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-11-19 13:04:46 +00:00
unmount(fuse, 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-11-19 13:04:46 +00:00
unmount(fuse1, function () {
2019-08-06 08:55:08 +00:00
fuse2.mount(function (err) {
2019-08-01 12:24:01 +00:00
t.error(err, 'no error')
t.ok(true, 'works')
2019-11-19 13:04:46 +00:00
unmount(fuse2, 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')
2019-11-19 13:04:46 +00:00
unmount(fuse, function () {
2019-08-07 10:55:41 +00:00
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()
})
})