mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-20 14:13:07 +00:00
19 lines
415 B
CoffeeScript
19 lines
415 B
CoffeeScript
mockFs = require('mock-fs')
|
|
config = require('../../lib/config')
|
|
|
|
exports.fs =
|
|
|
|
init: (filesystemConfig = {}) ->
|
|
mockFsOptions = {}
|
|
|
|
# Mock data prefix automatically to remove
|
|
# duplication in most of the tests
|
|
mockFsOptions[config.dataPrefix] = mockFs.directory()
|
|
|
|
for key, value of filesystemConfig
|
|
mockFsOptions[value.name] = value.contents
|
|
mockFs(mockFsOptions)
|
|
|
|
restore: ->
|
|
mockFs.restore()
|