Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

opts_fs.js 926B

1234567891011121314151617181920212223242526272829
  1. var mkdirp = require('../');
  2. var path = require('path');
  3. var test = require('tap').test;
  4. var mockfs = require('mock-fs');
  5. var _0777 = parseInt('0777', 8);
  6. var _0755 = parseInt('0755', 8);
  7. test('opts.fs', function (t) {
  8. t.plan(5);
  9. var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
  10. var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
  11. var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
  12. var file = '/beep/boop/' + [x,y,z].join('/');
  13. var xfs = mockfs.fs();
  14. mkdirp(file, { fs: xfs, mode: _0755 }, function (err) {
  15. t.ifError(err);
  16. xfs.exists(file, function (ex) {
  17. t.ok(ex, 'created file');
  18. xfs.stat(file, function (err, stat) {
  19. t.ifError(err);
  20. t.equal(stat.mode & _0777, _0755);
  21. t.ok(stat.isDirectory(), 'target not a directory');
  22. });
  23. });
  24. });
  25. });