Skip to content

Commit

Permalink
remove global tmp file variables
Browse files Browse the repository at this point in the history
  • Loading branch information
gretacb committed Nov 26, 2014
1 parent 29decfe commit 99da755
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
9 changes: 5 additions & 4 deletions test/stream-deserialize.test.js
Expand Up @@ -11,12 +11,11 @@ var assert = require('assert');
var unzip = require('zlib').createGunzip();
var crypto = require('crypto');

var filepath = path.join(tmp, crypto.randomBytes(12).toString('hex') + '.list.mbtiles');
var tmpSerial = path.join(tmp, crypto.randomBytes(12).toString('hex') + '.tilelive.serialized');
var tmpDst = path.join(tmp, crypto.randomBytes(12).toString('hex') + '.tilelive.dstMbtiles');

var src, dst;

// This is only used for deserialize: dst and deserialize: round trip tests
var filepath = path.join(tmp, crypto.randomBytes(12).toString('hex') + '.list_deserialize.mbtiles');

test('deserialize: src', function(t) {
new MBTiles(__dirname + '/fixtures/plain_1.mbtiles', function(err, s) {
t.ifError(err);
Expand Down Expand Up @@ -157,6 +156,8 @@ test('deserialize: garbage', function(t) {
});

test('de/serialize: round-trip', function(t) {
var tmpDst = path.join(tmp, crypto.randomBytes(12).toString('hex') + '.tilelive_roundtrip.dstMbtiles');
var tmpSerial = path.join(tmp, crypto.randomBytes(12).toString('hex') + '.tilelive.serialized');
var original = tilelive.createReadStream(src, {type: 'scanline'})
.on('error', function(err) { t.ifError(err); });
var serialize = tilelive.serialize()
Expand Down
4 changes: 1 addition & 3 deletions test/stream-list.test.js
Expand Up @@ -8,8 +8,6 @@ var Timedsource = require('./timedsource');

tilelive.stream.setConcurrency(10);

var filepath = path.join(tmp, 'list.mbtiles');

var src;
var dst;

Expand All @@ -22,7 +20,7 @@ test('list: src', function(t) {
});

test('list: dst', function(t) {
try { fs.unlinkSync(filepath); } catch(e) {}
var filepath = path.join(tmp, 'list_dst.mbtiles');
new MBTiles(filepath, function(err, d) {
t.ifError(err);
dst = d;
Expand Down
4 changes: 1 addition & 3 deletions test/stream-pyramid.test.js
Expand Up @@ -8,8 +8,6 @@ var Timedsource = require('./timedsource');

tilelive.stream.setConcurrency(10);

var filepath = path.join(tmp, 'pyramid.mbtiles');

var src;
var dst;

Expand All @@ -22,7 +20,7 @@ test('pyramid: src', function(t) {
});

test('pyramid: dst', function(t) {
try { fs.unlinkSync(filepath); } catch(e) {}
var filepath = path.join(tmp, 'pyramid_dst.mbtiles');
new MBTiles(filepath, function(err, d) {
t.ifError(err);
dst = d;
Expand Down
4 changes: 1 addition & 3 deletions test/stream-scanline.test.js
Expand Up @@ -8,8 +8,6 @@ var Timedsource = require('./timedsource');

tilelive.stream.setConcurrency(10);

var filepath = path.join(tmp, 'scanline.mbtiles');

var src;
var dst;

Expand All @@ -22,7 +20,7 @@ test('scanline: src', function(t) {
});

test('scanline: dst', function(t) {
try { fs.unlinkSync(filepath); } catch(e) {}
var filepath = path.join(tmp, 'scanline.mbtiles');
new MBTiles(filepath, function(err, d) {
t.ifError(err);
dst = d;
Expand Down
1 change: 0 additions & 1 deletion test/stream-write.test.js
@@ -1,7 +1,6 @@
var test = require('tape');
var tilelive = require('..');
var fs = require('fs');
var tmp = require('os').tmpdir();
var path = require('path');
var Timedsource = require('./timedsource');

Expand Down

0 comments on commit 99da755

Please sign in to comment.