UNPKG

digipinjs

Version:

A comprehensive TypeScript library for encoding and decoding Indian geographic coordinates into DIGIPIN format (Indian Postal Digital PIN system). Features CLI tools, caching, batch processing, and Express middleware for seamless integration.

21 lines (20 loc) 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const geojson_1 = require("../geojson"); describe('GeoJSON Utilities', () => { it('converts DIGIPIN to GeoJSON Point Feature', () => { const pin = '39J-438-TJC7'; // Delhi const feature = (0, geojson_1.toGeoJson)(pin); (0, chai_1.expect)(feature.type).to.equal('Feature'); (0, chai_1.expect)(feature.geometry.type).to.equal('Point'); (0, chai_1.expect)(feature.geometry.coordinates).to.have.length(2); (0, chai_1.expect)(feature.geometry.coordinates[0]).to.be.closeTo(77.2090, 0.0001); // Lng (0, chai_1.expect)(feature.geometry.coordinates[1]).to.be.closeTo(28.6139, 0.0001); // Lat (0, chai_1.expect)(feature.properties.pin).to.equal('39J438TJC7'); }); it('includes custom properties', () => { const feature = (0, geojson_1.toGeoJson)('39J-438-TJC7', { name: 'Delhi' }); (0, chai_1.expect)(feature.properties.name).to.equal('Delhi'); }); });