From 79a0c8b989ab667e0a513c391bc2d76f14212751 Mon Sep 17 00:00:00 2001 From: Alice Fage Date: Fri, 19 Jan 2024 11:52:48 +1300 Subject: [PATCH] test: test for 50k imagery bounds and naming --- .../__test__/create-manifest.test.ts | 4 ++-- .../__test__/tileindex.validate.test.ts | 6 +++++- src/utils/__test__/mapsheet.test.ts | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/commands/create-manifest/__test__/create-manifest.test.ts b/src/commands/create-manifest/__test__/create-manifest.test.ts index f38ec6e3..34906524 100644 --- a/src/commands/create-manifest/__test__/create-manifest.test.ts +++ b/src/commands/create-manifest/__test__/create-manifest.test.ts @@ -87,12 +87,12 @@ describe('createManifest', () => { ]); }); describe('validatePaths', () => { - it('Should throw error for Missmatch Paths', () => { + it('Should throw error for Mismatched Paths', () => { assert.throws(() => { validatePaths('memory://source/', 'memory://target/sub/test.tiff'); }, Error); }); - it('Should also throw error for Missmatch Paths', () => { + it('Should also throw error for Mismatched Paths', () => { assert.throws(() => { validatePaths('memory://source/test.tiff', 'memory://target/sub/'); }, Error); diff --git a/src/commands/tileindex-validate/__test__/tileindex.validate.test.ts b/src/commands/tileindex-validate/__test__/tileindex.validate.test.ts index 97c78a3b..02421307 100644 --- a/src/commands/tileindex-validate/__test__/tileindex.validate.test.ts +++ b/src/commands/tileindex-validate/__test__/tileindex.validate.test.ts @@ -36,13 +36,17 @@ describe('getTileName', () => { assert.equal(convertTileName('CH11_1000_0501', 5000), 'CH11_5000_0101'); assert.equal(convertTileName('CH11_1000_0505', 5000), 'CH11_5000_0101'); }); - it('should get correct parent tile 1:10k', () => { assert.equal(convertTileName('CH11_1000_0101', 10000), 'CH11_10000_0101'); assert.equal(convertTileName('CH11_1000_0110', 10000), 'CH11_10000_0101'); assert.equal(convertTileName('CH11_1000_1010', 10000), 'CH11_10000_0101'); assert.equal(convertTileName('CH11_1000_1001', 10000), 'CH11_10000_0101'); }); + it('should get correct parent tile 1:50k', () => { + assert.equal(convertTileName('AT24_50000_0101', 50000), 'AT24_50000_0101'); + assert.equal(convertTileName('AT25_50000_0101', 50000), 'AT25_50000_0101'); + assert.equal(convertTileName('CK08_50000_0101', 50000), 'CK08_50000_0101'); + }); }); describe('tiffLocation', () => { it('get location from tiff', async () => { diff --git a/src/utils/__test__/mapsheet.test.ts b/src/utils/__test__/mapsheet.test.ts index 3b821d21..ce914f61 100644 --- a/src/utils/__test__/mapsheet.test.ts +++ b/src/utils/__test__/mapsheet.test.ts @@ -19,6 +19,20 @@ describe('MapSheets', () => { }); }); + it('should generate 1:50k name', () => { + assert.deepEqual(MapSheet.extract('CK08_50000_0101.tiff'), { + mapSheet: 'CK08', + gridSize: 50000, + x: 1, + y: 1, + name: 'CK08', + origin: { x: 1180000, y: 4758000 }, + width: 24000, + height: 36000, + bbox: [1180000, 4722000, 1204000, 4758000], + }); + }); + it('should iterate mapsheets', () => { const sheets = [...MapSheet.iterate()]; assert.deepEqual(sheets, ExpectedCodes); @@ -29,6 +43,7 @@ describe('MapSheets', () => { assert.deepEqual(MapSheet.offset('AS21'), { x: 1492000, y: 6234000 }); assert.deepEqual(MapSheet.offset('BG33'), { x: 1780000, y: 5730000 }); assert.deepEqual(MapSheet.offset('BW14'), { x: 1324000, y: 5226000 }); + assert.deepEqual(MapSheet.offset('CK08'), { x: 1180000, y: 4758000 }); }); for (const ms of MapSheetData) {