Deindent post tapification.
This commit is contained in:
+4
-4
@@ -6,13 +6,13 @@ var MBTiles = require('..');
|
|||||||
var fixtureDir = __dirname + '/fixtures/output';
|
var fixtureDir = __dirname + '/fixtures/output';
|
||||||
var image = fs.readFileSync(__dirname + '/fixtures/images/plain_1_0_0_0.png');
|
var image = fs.readFileSync(__dirname + '/fixtures/images/plain_1_0_0_0.png');
|
||||||
|
|
||||||
tape('setup', function(assert) {
|
tape('setup', function(assert) {
|
||||||
// Recreate output directory to remove previous tests.
|
// Recreate output directory to remove previous tests.
|
||||||
try { fs.unlinkSync(fixtureDir + '/commit_1.mbtiles'); } catch(err) {}
|
try { fs.unlinkSync(fixtureDir + '/commit_1.mbtiles'); } catch(err) {}
|
||||||
try { fs.mkdirSync(fixtureDir, 0755); } catch(err) {}
|
try { fs.mkdirSync(fixtureDir, 0755); } catch(err) {}
|
||||||
assert.end();
|
assert.end();
|
||||||
});
|
});
|
||||||
tape('test mbtiles commit lock', function(assert) {
|
tape('test mbtiles commit lock', function(assert) {
|
||||||
var remaining = 10;
|
var remaining = 10;
|
||||||
new MBTiles('mbtiles://' + fixtureDir + '/commit_1.mbtiles?batch=1', function(err, mbtiles) {
|
new MBTiles('mbtiles://' + fixtureDir + '/commit_1.mbtiles?batch=1', function(err, mbtiles) {
|
||||||
assert.ifError(err, 'new MBTiles');
|
assert.ifError(err, 'new MBTiles');
|
||||||
@@ -27,4 +27,4 @@ var image = fs.readFileSync(__dirname + '/fixtures/images/plain_1_0_0_0.png');
|
|||||||
assert.ifError(err, 'putTile');
|
assert.ifError(err, 'putTile');
|
||||||
if (!--remaining) assert.end();
|
if (!--remaining) assert.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+5
-5
@@ -8,9 +8,9 @@ var fixtures = {
|
|||||||
empty: __dirname + '/fixtures/empty.mbtiles'
|
empty: __dirname + '/fixtures/empty.mbtiles'
|
||||||
};
|
};
|
||||||
|
|
||||||
try { fs.unlinkSync(fixtures.empty); } catch (err) {}
|
try { fs.unlinkSync(fixtures.empty); } catch (err) {}
|
||||||
|
|
||||||
tape('get metadata', function(assert) {
|
tape('get metadata', function(assert) {
|
||||||
new MBTiles(fixtures.plain_1, function(err, mbtiles) {
|
new MBTiles(fixtures.plain_1, function(err, mbtiles) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
|
|
||||||
@@ -39,8 +39,8 @@ var fixtures = {
|
|||||||
assert.end();
|
assert.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
tape('get/put metadata from empty file', function(assert) {
|
tape('get/put metadata from empty file', function(assert) {
|
||||||
var info = {
|
var info = {
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
level1: { level2: 'property' },
|
level1: { level2: 'property' },
|
||||||
@@ -94,4 +94,4 @@ var fixtures = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-3
@@ -7,12 +7,12 @@ var fixtures = {
|
|||||||
doesnotexist: __dirname + '/doesnotexist'
|
doesnotexist: __dirname + '/doesnotexist'
|
||||||
};
|
};
|
||||||
|
|
||||||
try { fs.unlinkSync(fixtures.doesnotexist); } catch (err) {}
|
try { fs.unlinkSync(fixtures.doesnotexist); } catch (err) {}
|
||||||
|
|
||||||
tape('list', function(assert) {
|
tape('list', function(assert) {
|
||||||
MBTiles.list(fixtures.doesnotexist, function(err, list) {
|
MBTiles.list(fixtures.doesnotexist, function(err, list) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.deepEqual(list, {});
|
assert.deepEqual(list, {});
|
||||||
assert.end();
|
assert.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+17
-17
@@ -22,11 +22,11 @@ function yieldsError(assert, error, msg, callback) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var loaded = {};
|
var loaded = {};
|
||||||
|
|
||||||
try { fs.unlinkSync(fixtures.non_existent); } catch (err) {}
|
try { fs.unlinkSync(fixtures.non_existent); } catch (err) {}
|
||||||
|
|
||||||
tape('setup', function(assert) {
|
tape('setup', function(assert) {
|
||||||
var queue = Object.keys(fixtures);
|
var queue = Object.keys(fixtures);
|
||||||
var load = function() {
|
var load = function() {
|
||||||
if (!queue.length) return assert.end();
|
if (!queue.length) return assert.end();
|
||||||
@@ -38,9 +38,9 @@ function yieldsError(assert, error, msg, callback) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
load();
|
load();
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.readdirSync(__dirname + '/fixtures/images/').forEach(function(file) {
|
fs.readdirSync(__dirname + '/fixtures/images/').forEach(function(file) {
|
||||||
var coords = file.match(/^plain_1_(\d+)_(\d+)_(\d+).png$/);
|
var coords = file.match(/^plain_1_(\d+)_(\d+)_(\d+).png$/);
|
||||||
if (!coords) return;
|
if (!coords) return;
|
||||||
|
|
||||||
@@ -60,21 +60,21 @@ function yieldsError(assert, error, msg, callback) {
|
|||||||
tape('grid ' + coords.join('/'), function(assert) {
|
tape('grid ' + coords.join('/'), function(assert) {
|
||||||
loaded.plain_1.getGrid(coords[0] | 0, coords[1] | 0, coords[2] | 0, yieldsError(assert, 'error', 'Grid does not exist', assert.end));
|
loaded.plain_1.getGrid(coords[0] | 0, coords[1] | 0, coords[2] | 0, yieldsError(assert, 'error', 'Grid does not exist', assert.end));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
[ [0,1,0],
|
[ [0,1,0],
|
||||||
[-1,0,0],
|
[-1,0,0],
|
||||||
[0,0,1],
|
[0,0,1],
|
||||||
[3,1,-1],
|
[3,1,-1],
|
||||||
[2,-3,3],
|
[2,-3,3],
|
||||||
[18,2,262140],
|
[18,2,262140],
|
||||||
[4,0,15]
|
[4,0,15]
|
||||||
].forEach(function(coords) {
|
].forEach(function(coords) {
|
||||||
tape('tile ' + coords.join('/'), function(assert) {
|
tape('tile ' + coords.join('/'), function(assert) {
|
||||||
loaded.plain_1.getTile(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'Tile does not exist', assert.end));
|
loaded.plain_1.getTile(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'Tile does not exist', assert.end));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.readdirSync(__dirname + '/fixtures/grids/').forEach(function(file) {
|
fs.readdirSync(__dirname + '/fixtures/grids/').forEach(function(file) {
|
||||||
var coords = file.match(/^plain_2_(\d+)_(\d+)_(\d+).json$/);
|
var coords = file.match(/^plain_2_(\d+)_(\d+)_(\d+).json$/);
|
||||||
if (!coords) return;
|
if (!coords) return;
|
||||||
|
|
||||||
@@ -101,23 +101,23 @@ function yieldsError(assert, error, msg, callback) {
|
|||||||
assert.end();
|
assert.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
[ [0,1,0],
|
[ [0,1,0],
|
||||||
[-1,0,0],
|
[-1,0,0],
|
||||||
[0,0,1],
|
[0,0,1],
|
||||||
[3,1,-1],
|
[3,1,-1],
|
||||||
[2,-3,3],
|
[2,-3,3],
|
||||||
[18,2,262140],
|
[18,2,262140],
|
||||||
[4,0,15]
|
[4,0,15]
|
||||||
].forEach(function(coords) {
|
].forEach(function(coords) {
|
||||||
tape('grid ' + coords.join('/'), function(assert) {
|
tape('grid ' + coords.join('/'), function(assert) {
|
||||||
loaded.plain_2.getGrid(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'Grid does not exist', assert.end));
|
loaded.plain_2.getGrid(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'Grid does not exist', assert.end));
|
||||||
});
|
});
|
||||||
tape('grid alt ' + coords.join('/'), function(assert) {
|
tape('grid alt ' + coords.join('/'), function(assert) {
|
||||||
loaded.plain_4.getGrid(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'Grid does not exist', assert.end));
|
loaded.plain_4.getGrid(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'Grid does not exist', assert.end));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
[ [0,1,0],
|
[ [0,1,0],
|
||||||
[-1,0,0],
|
[-1,0,0],
|
||||||
[0,0,-1],
|
[0,0,-1],
|
||||||
[3,1,8],
|
[3,1,8],
|
||||||
@@ -131,12 +131,12 @@ function yieldsError(assert, error, msg, callback) {
|
|||||||
[4,0,14],
|
[4,0,14],
|
||||||
[3,0,7],
|
[3,0,7],
|
||||||
[3,6,2]
|
[3,6,2]
|
||||||
].forEach(function(coords) {
|
].forEach(function(coords) {
|
||||||
tape('dne ' + coords.join('/'), function(assert) {
|
tape('dne ' + coords.join('/'), function(assert) {
|
||||||
loaded.non_existent.getTile(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'Tile does not exist', assert.end));
|
loaded.non_existent.getTile(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'Tile does not exist', assert.end));
|
||||||
});
|
});
|
||||||
tape('corrupt ' + coords.join('/'), function(assert) {
|
tape('corrupt ' + coords.join('/'), function(assert) {
|
||||||
loaded.corrupt.getTile(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'SQLITE_CORRUPT: database disk image is malformed', assert.end));
|
loaded.corrupt.getTile(coords[0], coords[1], coords[2], yieldsError(assert, 'error', 'SQLITE_CORRUPT: database disk image is malformed', assert.end));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -5,11 +5,11 @@ var tape = require('tape');
|
|||||||
var MBTiles = require('..');
|
var MBTiles = require('..');
|
||||||
var fixtureDir = __dirname + '/fixtures/output';
|
var fixtureDir = __dirname + '/fixtures/output';
|
||||||
|
|
||||||
// Recreate output directory to remove previous tests.
|
// Recreate output directory to remove previous tests.
|
||||||
try { fs.unlinkSync(fixtureDir + '/write_1.mbtiles'); } catch(err) {}
|
try { fs.unlinkSync(fixtureDir + '/write_1.mbtiles'); } catch(err) {}
|
||||||
try { fs.mkdirSync(fixtureDir, 0755); } catch(err) {}
|
try { fs.mkdirSync(fixtureDir, 0755); } catch(err) {}
|
||||||
|
|
||||||
tape('test mbtiles file creation', function(assert) {
|
tape('test mbtiles file creation', function(assert) {
|
||||||
var completed = { written: 0, read: 0 };
|
var completed = { written: 0, read: 0 };
|
||||||
new MBTiles(fixtureDir + '/write_1.mbtiles', function(err, mbtiles) {
|
new MBTiles(fixtureDir + '/write_1.mbtiles', function(err, mbtiles) {
|
||||||
completed.open = true;
|
completed.open = true;
|
||||||
@@ -59,4 +59,4 @@ var fixtureDir = __dirname + '/fixtures/output';
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ var tape = require('tape');
|
|||||||
var MBTiles = require('..');
|
var MBTiles = require('..');
|
||||||
var fixtureDir = __dirname + '/fixtures/output';
|
var fixtureDir = __dirname + '/fixtures/output';
|
||||||
|
|
||||||
// Recreate output directory to remove previous tests.
|
// Recreate output directory to remove previous tests.
|
||||||
try { fs.unlinkSync(fixtureDir + '/write_2.mbtiles'); } catch(err) {}
|
try { fs.unlinkSync(fixtureDir + '/write_2.mbtiles'); } catch(err) {}
|
||||||
try { fs.mkdirSync(fixtureDir, 0755); } catch(err) {}
|
try { fs.mkdirSync(fixtureDir, 0755); } catch(err) {}
|
||||||
|
|
||||||
tape('test mbtiles file creation', function(assert) {
|
tape('test mbtiles file creation', function(assert) {
|
||||||
var completed = { written: 0, read: 0 };
|
var completed = { written: 0, read: 0 };
|
||||||
new MBTiles(fixtureDir + '/write_2.mbtiles', function(err, mbtiles) {
|
new MBTiles(fixtureDir + '/write_2.mbtiles', function(err, mbtiles) {
|
||||||
completed.open = true;
|
completed.open = true;
|
||||||
@@ -59,4 +59,4 @@ var fixtureDir = __dirname + '/fixtures/output';
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user