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.

return_sync.js 855B

123456789101112131415161718192021222324
  1. var mkdirp = require('../');
  2. var path = require('path');
  3. var fs = require('fs');
  4. var test = require('tap').test;
  5. test('return value', function (t) {
  6. t.plan(2);
  7. var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
  8. var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
  9. var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
  10. var file = '/tmp/' + [x,y,z].join('/');
  11. // should return the first dir created.
  12. // By this point, it would be profoundly surprising if /tmp didn't
  13. // already exist, since every other test makes things in there.
  14. // Note that this will throw on failure, which will fail the test.
  15. var made = mkdirp.sync(file);
  16. t.equal(made, '/tmp/' + x);
  17. // making the same file again should have no effect.
  18. made = mkdirp.sync(file);
  19. t.equal(made, null);
  20. });