Skip to main content
Glama
adminexpress.test.ts1.67 kB
import {getAdminUnits} from "../../src/gpf/adminexpress.js"; import { mairieLoray } from "../samples"; describe("Test getAdminUnits",() => { it("should expected values for Mairie de Loray", async () => { const c = mairieLoray.coordinates; const items : any[] = await getAdminUnits(c[0],c[1]); const itemsTypes = items.map((item) => item.type); expect(itemsTypes).toEqual([ "commune", "canton", "collectivite_territoriale", "epci", "departement", "region", "arrondissement" ]); // check item of type departement { const departement = items.filter((item)=>item.type === 'departement')[0]; expect(departement).not.toBeUndefined(); expect(departement.nom_officiel).toEqual('Doubs'); expect(departement.nom_officiel_en_majuscules).toEqual('DOUBS'); expect(departement.code_insee).toEqual('25'); expect(departement.code_insee_de_la_region).toEqual('27'); expect(departement.code_siren).toEqual('222500019'); } // check item of type commune { const commune = items.filter((item)=>item.type === 'commune')[0]; expect(commune).not.toBeUndefined(); expect(commune.nom_officiel).toEqual('Loray'); expect(commune.nom_officiel_en_majuscules).toEqual('LORAY'); expect(commune.code_insee_du_departement).toEqual('25'); expect(commune.code_insee_de_la_region).toEqual('27'); expect(commune.code_siren).toEqual('212503494'); } }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ignfab/geocontext'

If you have feedback or need assistance with the MCP directory API, please join our Discord server