UNPKG

philippine-administrative-divisions

Version:

Regions, Provinces, Municipalities and cities, and barangays of the Philippines

44 lines (43 loc) 2.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("../index"); test('Function getRegions returns 18 regions', () => { expect((0, index_1.getRegions)().length).toBe(18); }); test('Function getRegions returns an array containing REGION I', () => { expect((0, index_1.getRegions)()).toContain('REGION I'); }); test('Function getProvinces returns an array containing BOHOL', () => { expect((0, index_1.getProvinces)()).toContain('BOHOL'); }); test(`Function getProvincesByRegionName returns an array containing BOHOL when param is 'REGION VII'`, () => { expect((0, index_1.getProvincesByRegionName)('REGION VII')).toContain('BOHOL'); }); test(`Function getProvincesByRegionName returns false when param does not exist`, () => { expect((0, index_1.getProvincesByRegionName)('NONEXISTINGREGION')).toBe(false); }); test(`Function getProvincesByRegionName returns an array even if param is lowercase`, () => { expect((0, index_1.getProvincesByRegionName)('region vii')).toContain('BOHOL'); }); test('Function getMunicipalitiesByProvince returns an array when exists', () => { expect((0, index_1.getMunicipalitiesByProvince)('BOHOL')).toContain('ALBURQUERQUE'); }); test('Function getMunicipalitiesByProvince returns an array even when param is lowercase', () => { expect((0, index_1.getMunicipalitiesByProvince)('bohol')).toContain('ALBURQUERQUE'); }); test('Function getMunicipalitiesByProvince returns false when province does NOT exist', () => { expect((0, index_1.getMunicipalitiesByProvince)('NONEXISTINGPROVINCE')).toBe(false); }); test('Function getBarangaysByProvinceAndMunicipality will return an array when exists', () => { expect((0, index_1.getBarangaysByProvinceAndMunicipality)('BOHOL', 'ALBURQUERQUE')).toContain('BAHI'); }); test(`Function searchProvincesByStartString will return an array when provinces starting with the start string exists`, () => { expect((0, index_1.searchProvincesByStartString)('boh')).toContain('BOHOL'); }); test(`Function searchRegionsByStartString will return an array when regions starting with the start string exists`, () => { expect((0, index_1.searchRegionsByStartString)('reg')).toContain('REGION I'); });