Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/configurations/unit/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
'!<rootDir>/src/*',
'!<rootDir>/src/serviceClients/database/SQLiteClient.ts',
'!<rootDir>/src/ingestion/errors/ingestionErrors.ts',
'!<rootDir>/src/utils/stringCapitalizationPermutations.ts',
'!<rootDir>/src/**/interfaces.ts',
'!<rootDir>/src/utils/hash/constants.ts',
],
Expand Down
36 changes: 33 additions & 3 deletions tests/integration/info/info.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import type { DeepPartial, DeepRequired, FlattenKeyTupleUnion } from '../../util
import { getTestContainerConfig, resetContainer } from './helpers/containerConfig';
import { InfoRequestSender } from './helpers/infoRequestSender';

describe('Info', function () {
describe('Info', () => {
let requestSender: InfoRequestSender;

beforeEach(function () {
beforeEach(() => {
const [app] = getApp({
override: [...getTestContainerConfig()],
});

requestSender = new InfoRequestSender(app);
});

afterEach(function () {
afterEach(() => {
resetContainer();
jest.restoreAllMocks();
nock.cleanAll();
Expand Down Expand Up @@ -58,6 +58,36 @@ describe('Info', function () {
expect(response.body).toStrictEqual(expectedResponseBody);
});

//Added this test to make sure that pixelSize is not a rounded number but the exact number resolution
it('should return 200 status code and sources info from gpkg file with zoom level 21', async () => {
const request = { gpkgFilesPath: getGpkgsFilesLocalPath(['zoom21.gpkg']) };
const expectedResponseBody = [
{
crs: 4326,
fileFormat: 'GPKG',
pixelSize: 0.000000335276126861572,
extentPolygon: {
type: 'Polygon',
coordinates: [
[
[34.4870513, 31.5316438],
[34.4870513, 31.5297716],
[34.4892373, 31.5297716],
[34.4892373, 31.5316438],
[34.4870513, 31.5316438],
],
],
},
fileName: 'tests/mocks/testFiles/gpkg/zoom21.gpkg',
},
];

const response = await requestSender.getGpkgsInfo(request);

expect(response.status).toBe(httpStatusCodes.OK);
expect(response.body).toStrictEqual(expectedResponseBody);
});

it('should return 200 status code and sources info invalid response - unsupported CRS', async () => {
const badRequest = { gpkgFilesPath: getGpkgsFilesLocalPath(['invalidCrs-3857.gpkg']) };
const expectedResponseBody = [
Expand Down
16 changes: 15 additions & 1 deletion tests/integration/ingestion/helpers/containerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ import { container, instancePerContainerCachingFactory } from 'tsyringe';
import { SERVICES } from '../../../../src/common/constants';
import { InjectionObject } from '../../../../src/common/dependencyRegistration';
import { GDAL_INFO_MANAGER_SYMBOL, GdalInfoManager } from '../../../../src/info/models/gdalInfoManager';
import { CHECKSUM_PROCESSOR } from '../../../../src/utils/hash/constants';
import type { ChecksumProcessor } from '../../../../src/utils/hash/interfaces';
import { INGESTION_SCHEMAS_VALIDATOR_SYMBOL, schemasValidationsFactory } from '../../../../src/utils/validation/schemasValidator';
import { configMock, getMock, hasMock, registerDefaultConfig } from '../../../mocks/configMock';

function getTestContainerConfig(): InjectionObject<unknown>[] {
interface ContainerConfigOptions {
checksumProcessor: () => () => Promise<ChecksumProcessor>;
}

function getTestContainerConfig({ checksumProcessor }: ContainerConfigOptions): InjectionObject<unknown>[] {
registerDefaultConfig();

return [
Expand All @@ -16,6 +22,14 @@ function getTestContainerConfig(): InjectionObject<unknown>[] {
{ token: SERVICES.TRACER, provider: { useValue: trace.getTracer('testTracer') } },
{ token: INGESTION_SCHEMAS_VALIDATOR_SYMBOL, provider: { useFactory: instancePerContainerCachingFactory(schemasValidationsFactory) } },
{ token: GDAL_INFO_MANAGER_SYMBOL, provider: { useClass: GdalInfoManager } },
{
token: CHECKSUM_PROCESSOR,
provider: {
useFactory: (): (() => Promise<ChecksumProcessor>) => {
return checksumProcessor();
},
},
},
];
}

Expand Down
Loading