All files / src/emulator-state file-system.js

100% Statements 7/7
100% Branches 4/4
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 171x 1x 1x   1x                 131x 131x    
import * as FileUtil from 'fs/util/file-util';
import * as DirOp from 'fs/operations/directory-operations';
import { fromJS } from 'immutable';
 
const DEFAULT_FILE_SYSTEM = {
  '/': FileUtil.makeDirectory()
};
 
/**
 * Creates an immutable data structure for a file system
 * @param  {object} jsFs a file system in a simple JavaScript object
 * @return {Map}         an immutable file system
 */
export const create = (jsFs = DEFAULT_FILE_SYSTEM) => {
  return DirOp.fillGaps(fromJS(jsFs));
};