]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/mkdirp/test/return_sync.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / mkdirp / test / return_sync.js
1 var mkdirp = require('../');
2 var path = require('path');
3 var fs = require('fs');
4 var test = require('tap').test;
5
6 test('return value', function (t) {
7     t.plan(2);
8     var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
9     var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
10     var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
11
12     var file = '/tmp/' + [x,y,z].join('/');
13
14     // should return the first dir created.
15     // By this point, it would be profoundly surprising if /tmp didn't
16     // already exist, since every other test makes things in there.
17     // Note that this will throw on failure, which will fail the test.
18     var made = mkdirp.sync(file);
19     t.equal(made, '/tmp/' + x);
20
21     // making the same file again should have no effect.
22     made = mkdirp.sync(file);
23     t.equal(made, null);
24 });