Skip to content

Commit

Permalink
他の関数名に合わせて、lookfor関数をmatchに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
sugama-satsuki committed Jul 12, 2024
1 parent 6e768fe commit c13e3e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class GeoJsonlookfor {
/* *****************
* "keyword"を含む項目があるfeatureを検索する
* *****************/
lookfor(keyword: string) {
match(keyword: string) {
try {
if (this.geojson === undefined || this.geojson === null || typeof this.geojson !== 'object' || typeof this.geojson === 'string') {
throw new Error('Invalid GeoJSON');
Expand Down
16 changes: 8 additions & 8 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('The first test', () => {
// スイーツショップを検索する
it('should be lookfor sweetsshop.', () => {
const gl = new GeoJsonlookfor(geojson);
const res1 = gl.lookfor('スイーツショップ').getGeoJSON();
const res1 = gl.match('スイーツショップ').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": [
Expand All @@ -43,7 +43,7 @@ describe('The first test', () => {
]
}, res1 );

const res2 = gl.lookfor('銭湯').getGeoJSON();
const res2 = gl.match('銭湯').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": [ ]
Expand All @@ -54,7 +54,7 @@ describe('The first test', () => {
// "スイーツ"を含む項目があるfeatureを検索する
it('should be lookfor features that include "sweets".', () => {
const gl = new GeoJsonlookfor(geojson);
const res1 = gl.lookfor('スイーツ').getGeoJSON();
const res1 = gl.match('スイーツ').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": [
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('The first test', () => {
// "さいたま市"を含むfeatureを検索する
it('should be lookfor features include "さいたま市".', () => {
const gl = new GeoJsonlookfor(geojson);
const res1 = gl.lookfor('さいたま市').getGeoJSON();
const res1 = gl.match('さいたま市').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": [
Expand All @@ -147,7 +147,7 @@ describe('The first test', () => {
]
}, res1 );

const res2 = gl.lookfor('那覇市').getGeoJSON();
const res2 = gl.match('那覇市').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": []
Expand All @@ -158,7 +158,7 @@ describe('The first test', () => {
it('string as argument', () => {
try {
const gl = new GeoJsonlookfor(pmtile);
const res1 = gl.lookfor('家電').getGeoJSON();
const res1 = gl.match('家電').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": [
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('The first test', () => {
it('json as argument', () => {
try {
const gl = new GeoJsonlookfor(json);
const res1 = gl.lookfor('家電').getGeoJSON();
const res1 = gl.match('家電').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": [
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('The first test', () => {
it('csv as argument', () => {
try {
const gl = new GeoJsonlookfor(csv);
const res1 = gl.lookfor('家電').getGeoJSON();
const res1 = gl.match('家電').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": [
Expand Down
4 changes: 2 additions & 2 deletions test/testByType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('AND search test', () => {
// AND検索をする(スイーツショップかつ、上尾市)
it('should be lookfor features include "スイーツ" and "上尾市".', () => {
const lookfor = new GeoJsonlookfor(geojson);
const res1 = lookfor.lookfor('スイーツ').lookfor('上尾市').getGeoJSON();
const res1 = lookfor.match('スイーツ').match('上尾市').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": [
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('AND search test', () => {
]
}, res1 );

const res2 = lookfor.lookfor('スイーツ').lookfor('那覇市').getGeoJSON();
const res2 = lookfor.match('スイーツ').match('那覇市').getGeoJSON();
assert.deepEqual( {
"type": "FeatureCollection",
"features": []
Expand Down

0 comments on commit c13e3e2

Please sign in to comment.