Skip to content

Commit

Permalink
test: test for 50k imagery bounds and naming
Browse files Browse the repository at this point in the history
  • Loading branch information
amfage committed Jan 18, 2024
1 parent f81a5b9 commit 79a0c8b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/commands/create-manifest/__test__/create-manifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
15 changes: 15 additions & 0 deletions src/utils/__test__/mapsheet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 79a0c8b

Please sign in to comment.