Skip to content
Merged
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
3 changes: 1 addition & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run verify:fast
# basic functional testing
# https://github.com/modelcontextprotocol/inspector?tab=readme-ov-file#cli-mode
- name: List tools
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
with:
node-version: 24.x
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run verify:fast

publish-npm:
needs: build
Expand All @@ -26,7 +25,7 @@ jobs:
node-version: 24.5.0
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build --if-present
- run: npm run verify:fast
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ export NO_PROXY=localhost,127.0.0.1
Les commandes principales sont :

```bash
npm run typecheck
npm run typecheck:test
npm test
npm run test:integration
npm run test:e2e
Expand All @@ -209,6 +211,8 @@ npm run verify
npm run verify:full
```

`npm run verify:fast` inclut le type-check de l'application et des fichiers de test avant le build et les tests unitaires.

Remarque :

- Les outils `gpf_wfs_search_types` et `gpf_wfs_describe_type` s'appuient sur un catalogue de schémas embarqué fourni par `@ignfab/gpf-schema-store`.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"test:integration": "vitest run --config vitest.integration.config.mts",
"test:e2e": "vitest run --config vitest.e2e.config.mts",
"test:coverage": "vitest run --coverage",
"verify:fast": "npm run typecheck && npm run build && npm run test:unit",
"verify:fast": "npm run typecheck && npm run typecheck:test && npm run build && npm run test:unit",
Comment thread
esgn marked this conversation as resolved.
"verify": "npm run verify:fast && npm run test:integration",
"verify:full": "npm run verify && npm run test:e2e",
"fresh": "npm run reset:local && npm ci && npm run verify",
Expand Down
2 changes: 1 addition & 1 deletion test/gpf/adminexpress.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { vi } from "vitest";
import { vi, describe, expect, afterEach, beforeEach, it } from "vitest";
import { mairieLoray } from "../samples";

const mockGetFeatureType = vi.fn<(typename: string) => Promise<any>>();
Expand Down
1 change: 1 addition & 0 deletions test/gpf/altitude.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from "vitest";
import {getAltitudeByLocation} from "../../src/gpf/altitude.js";
import { paris } from "../samples";

Expand Down
1 change: 1 addition & 0 deletions test/gpf/geocode.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from "vitest";
import {geocode} from "../../src/gpf/geocode.js";

const rawGeocodeServiceResponse = {
Expand Down
2 changes: 1 addition & 1 deletion test/gpf/parcellaire-express.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { vi } from "vitest";
import { vi, describe, expect, it, beforeEach, afterEach } from "vitest";
import { mairieLoray } from "../samples";

const mockGetFeatureType = vi.fn<(typename: string) => Promise<any>>();
Expand Down
2 changes: 1 addition & 1 deletion test/gpf/urbanisme.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { vi } from "vitest";
import { afterEach, beforeEach, describe, expect, vi, it } from "vitest";
import { chamonix, mairieLoray } from "../samples";

const mockGetFeatureType = vi.fn<(typename: string) => Promise<any>>();
Expand Down
1 change: 1 addition & 0 deletions test/gpf/wfs-schema-catalog.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, afterEach, beforeEach, it } from "vitest";
import { FeatureTypeNotFoundError, WfsClient, wfsClient, loadMiniSearchOptionsFromEnv } from "../../src/gpf/wfs-schema-catalog";

const GPF_WFS_MINISEARCH_OPTIONS_ENV = "GPF_WFS_MINISEARCH_OPTIONS";
Expand Down
2 changes: 2 additions & 0 deletions test/helpers/distance.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from "vitest";

import distance from "../../src/helpers/distance.js";
import type { Polygon } from "geojson";
import {paris, marseille, besancon, parisMarseille} from '../samples';
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/http.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, vi } from "vitest";
import { afterEach, beforeEach, vi, describe, it, expect } from "vitest";
import fetch from "node-fetch";

vi.mock("node-fetch", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/toolError.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { vi, describe, it, expect } from "vitest";
import { z } from "zod";
import { vi } from "vitest";

import { ServiceResponseError } from "../../src/helpers/http.js";
import { normalizeToolError } from "../../src/helpers/errors/toolError.js";
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/wfs_engine/execution.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { vi } from "vitest";
import { vi, describe, expect, afterEach, it } from "vitest";

const mockFetchJSONPost = vi.fn<(
url: string,
Expand Down
1 change: 1 addition & 0 deletions test/helpers/wfs_engine/geometry.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from "vitest";
import { geometryToEwkt } from "../../../src/helpers/wfs_engine/geometry";

describe("geometryToEwkt", () => {
Expand Down
1 change: 1 addition & 0 deletions test/helpers/wfs_engine/queryPreparation.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from "vitest";
import type { Collection } from "@ignfab/gpf-schema-store";

import { compileQueryParts, geometryToEwkt } from "../../../src/helpers/wfs_engine/queryPreparation";
Expand Down
1 change: 1 addition & 0 deletions test/helpers/wfs_engine/request.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it } from "vitest";
import { buildMultiTypenameRequest } from "../../../src/helpers/wfs_engine/request";

describe("wfs_engine/request", () => {
Expand Down
2 changes: 2 additions & 0 deletions test/helpers/wfs_engine/response.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from "vitest";

import {
mapToFlatItems,
mapToFlatItemsWithGeometry,
Expand Down
2 changes: 2 additions & 0 deletions test/helpers/wfs_engine/spatialCql.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from "vitest";

import {
compileBboxSpatialFilter,
compileIntersectsPointSpatialFilter,
Expand Down
2 changes: 2 additions & 0 deletions test/helpers/wfs_engine/spatialFilter.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from "vitest";

import { getSpatialFilter } from "../../../src/helpers/wfs_engine/spatialFilter";
import type { GpfWfsGetFeaturesInput } from "../../../src/helpers/wfs_engine/schema";

Expand Down
4 changes: 2 additions & 2 deletions test/integration/helpers/level1-assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function expectNonEmptyResults<T>(
minimum = 1,
): asserts value is { results: T[] } {
expect(value.results).toBeDefined();
expect(value.results.length).toBeGreaterThanOrEqual(minimum);
expect(value.results!.length).toBeGreaterThanOrEqual(minimum);
}
Comment thread
esgn marked this conversation as resolved.

/**
Expand All @@ -37,7 +37,7 @@ export function expectFeatureCollectionWithFeatures<TFeature>(
): asserts value is { type: "FeatureCollection"; features: TFeature[] } {
expect(value.type).toBe("FeatureCollection");
expect(value.features).toBeDefined();
expect(value.features.length).toBeGreaterThanOrEqual(minimum);
expect(value.features!.length).toBeGreaterThanOrEqual(minimum);
}
Comment thread
esgn marked this conversation as resolved.

/**
Expand Down
2 changes: 2 additions & 0 deletions test/tools/adminexpress.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

import AdminexpressTool from "../../src/tools/AdminexpressTool";
import { mairieLoray } from "../samples";

Expand Down
2 changes: 2 additions & 0 deletions test/tools/altitude.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

import AltitudeTool from "../../src/tools/AltitudeTool";
import { paris } from "../samples";

Expand Down
2 changes: 2 additions & 0 deletions test/tools/base-tool-error.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

import { z } from "zod";

import BaseTool from "../../src/tools/BaseTool.js";
Expand Down
2 changes: 2 additions & 0 deletions test/tools/cadastre.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

import CadastreTool from "../../src/tools/CadastreTool";
import { mairieLoray } from "../samples";

Expand Down
2 changes: 2 additions & 0 deletions test/tools/geocode.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

import GeocodeTool from "../../src/tools/GeocodeTool";

describe("Test GeocodeTool",() => {
Expand Down
2 changes: 2 additions & 0 deletions test/tools/strict-input.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

import AdminexpressTool from "../../src/tools/AdminexpressTool";
import AltitudeTool from "../../src/tools/AltitudeTool";
import AssietteSupTool from "../../src/tools/AssietteSupTool";
Expand Down
2 changes: 2 additions & 0 deletions test/tools/urbanisme.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

import AssietteSupTool from "../../src/tools/AssietteSupTool";
import UrbanismeTool from "../../src/tools/UrbanismeTool";
import { chamonix, mairieLoray } from "../samples";
Expand Down
2 changes: 2 additions & 0 deletions test/tools/wfs/describeType.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

import type { Collection } from "@ignfab/gpf-schema-store";

import GpfWfsDescribeTypeTool from "../../../src/tools/GpfWfsDescribeTypeTool";
Expand Down
3 changes: 2 additions & 1 deletion test/tools/wfs/getFeatureById.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { vi, describe, it, expect, afterEach } from "vitest";

import type { Collection } from "@ignfab/gpf-schema-store";
import { vi } from "vitest";
import { ServiceResponseError } from "../../../src/helpers/http.js";

const mockGetFeatureType = vi.fn<(typename: string) => Promise<Collection>>();
Expand Down
3 changes: 2 additions & 1 deletion test/tools/wfs/getFeatures.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { vi, describe, it, expect, afterEach } from "vitest";

import type { Collection } from "@ignfab/gpf-schema-store";
import { vi } from "vitest";
import { ServiceResponseError } from "../../../src/helpers/http.js";

const mockGetFeatureType = vi.fn<(typename: string) => Promise<Collection>>();
Expand Down
2 changes: 2 additions & 0 deletions test/tools/wfs/searchTypes.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from "vitest";

import GpfWfsSearchTypesTool from "../../../src/tools/GpfWfsSearchTypesTool";

describe("Test GpfWfsSearchTypesTool",() => {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"include": [
"./src/**/*",
"./test/**/*"
"./test/**/*",
"./vitest*.mts"
],
Comment thread
esgn marked this conversation as resolved.
"exclude": [
"node_modules",
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
},
test: {
globals: true,
globals: false,
environment: "node",
include: ["test/**/*.test.ts"],
exclude: ["test/integration/**/*"],
Expand Down
2 changes: 1 addition & 1 deletion vitest.e2e.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
},
test: {
globals: true,
globals: false,
environment: "node",
include: ["test/integration/level2-agent/**/*.test.ts"],
testTimeout: 120 * MILLISECONDS,
Expand Down
2 changes: 1 addition & 1 deletion vitest.integration.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
},
test: {
globals: true,
globals: false,
environment: "node",
include: ["test/integration/level1-protocol/**/*.test.ts"],
testTimeout: 60 * MILLISECONDS,
Expand Down
Loading