From d724a5cd0346e5ee8a53f1f1d94e0b9376b73293 Mon Sep 17 00:00:00 2001 From: razbroc Date: Mon, 24 Aug 2026 15:44:44 +0300 Subject: [PATCH] test: cover a geopackage Cache at the HTTP seam geopackage is an accepted cacheType, and its response schema now exists, but no geopackage Cache existed in any fixture - so nothing proved a real geopackage response satisfies the contract. The live dev configuration holds no geopackage Cache either, so the fixture Cache Source is derived from GpkgSource. Verified that this test fails against the pre-loosening contract with 'cache must match exactly one schema in oneOf'. --- .../integration/layers/layersManager.spec.ts | 19 +++++++++++++++++++ tests/unit/mock/mockJson.json | 17 +++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/tests/integration/layers/layersManager.spec.ts b/tests/integration/layers/layersManager.spec.ts index d209a2f..7429917 100644 --- a/tests/integration/layers/layersManager.spec.ts +++ b/tests/integration/layers/layersManager.spec.ts @@ -114,6 +114,25 @@ describe('layerManager', () => { expect(response.body).toHaveProperty('cache.region', 'us-east-1'); }); + it('Happy Path - should return status 200 and the whole Cache of a geopackage Cache', async () => { + const response = await requestSender.getLayersCache('gpkgExists', 'geopackage'); + + expect(response.status).toBe(httpStatusCodes.OK); + expect(response).toSatisfyApiSpec(); + expect(response.body).toEqual({ + cacheName: 'gpkgExists', + sources: [], + grids: ['epsg4326dir'], + format: 'image/png', + // eslint-disable-next-line @typescript-eslint/naming-convention + upscale_tiles: 18, + // eslint-disable-next-line @typescript-eslint/naming-convention + minimize_meta_requests: true, + // eslint-disable-next-line @typescript-eslint/naming-convention + cache: { type: 'geopackage', filename: '/path/to/tiles/directory/gpkgExists.gpkg', table_name: 'gpkgExists' }, + }); + }); + it('Sad Path - should fail with response status 404 Not Found and layer name is not exists', async () => { const mockLayerName = 'mockLayerNameIsNotExists'; const response = await requestSender.getLayersCache(mockLayerName, 's3'); diff --git a/tests/unit/mock/mockJson.json b/tests/unit/mock/mockJson.json index d29a449..59551d9 100644 --- a/tests/unit/mock/mockJson.json +++ b/tests/unit/mock/mockJson.json @@ -54,6 +54,18 @@ "default_ttl": 86400 } }, + "gpkgExists": { + "sources": [], + "grids": ["epsg4326dir"], + "format": "image/png", + "upscale_tiles": 18, + "minimize_meta_requests": true, + "cache": { + "type": "geopackage", + "filename": "/path/to/tiles/directory/gpkgExists.gpkg", + "table_name": "gpkgExists" + } + }, "redisExists": { "sources": [], "grids": ["epsg4326dir"], @@ -97,6 +109,11 @@ "title": "title", "sources": ["source"] }, + { + "name": "gpkgExists", + "title": "title", + "sources": ["gpkgExists"] + }, { "name": "redisExists", "title": "redisExists-redis",