diff --git a/Logic/Actors/ImageSearcher.ts b/Logic/Actors/ImageSearcher.ts index 0c1c934..3ea5101 100644 --- a/Logic/Actors/ImageSearcher.ts +++ b/Logic/Actors/ImageSearcher.ts @@ -81,7 +81,7 @@ export class ImageSearcher extends UIEventSource<{ key: string, url: string }[]> let mapillary = tags.mapillary; const prefix = "https://www.mapillary.com/map/im/"; - let regex = /https?:\/\/www.mapillary.com\/app\/.*&pKey=([^&]*)/ + let regex = /https?:\/\/www.mapillary.com\/app\/.*pKey=([^&]*).*/ let match = mapillary.match(regex); if (match) { mapillary = match[1]; diff --git a/Models/Constants.ts b/Models/Constants.ts index 8769600..e7a8c2b 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import { Utils } from "../Utils"; export default class Constants { - public static vNumber = "0.6.5c"; + public static vNumber = "0.6.5d"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/package.json b/package.json index 1767a59..2ab8e4d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "increase-memory": "export NODE_OPTIONS=--max_old_space_size=4096", "start": "npm run increase-memory && parcel *.html UI/** Logic/** assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*", - "test": "ts-node test/Tag.spec.ts && ts-node test/TagQuestion.spec.ts", + "test": "ts-node test/Tag.spec.ts && ts-node test/TagQuestion.spec.ts && ts-node test/ImageSearcher.spec.ts", "generate:editor-layer-index": "cd assets/ && wget https://osmlab.github.io/editor-layer-index/imagery.geojson --output-document=editor-layer-index.json", "generate:images": "ts-node scripts/generateIncludedImages.ts", "generate:translations": "ts-node scripts/generateTranslations.ts", diff --git a/test/ImageSearcher.spec.ts b/test/ImageSearcher.spec.ts new file mode 100644 index 0000000..69462be --- /dev/null +++ b/test/ImageSearcher.spec.ts @@ -0,0 +1,35 @@ +import {Utils} from "../Utils"; + +Utils.runningFromConsole = true; +import {equal} from "assert"; +import T from "./TestHelper"; +import {FromJSON} from "../Customizations/JSON/FromJSON"; +import Locale from "../UI/i18n/Locale"; +import Translations from "../UI/i18n/Translations"; +import {UIEventSource} from "../Logic/UIEventSource"; +import TagRenderingConfig from "../Customizations/JSON/TagRenderingConfig"; +import EditableTagRendering from "../UI/Popup/EditableTagRendering"; +import {Translation} from "../UI/i18n/Translation"; +import {OH, OpeningHour} from "../UI/OpeningHours/OpeningHours"; +import PublicHolidayInput from "../UI/OpeningHours/PublicHolidayInput"; +import {SubstitutedTranslation} from "../UI/SubstitutedTranslation"; +import {Tag} from "../Logic/Tags/Tag"; +import {And} from "../Logic/Tags/And"; +import {ImageSearcher} from "../Logic/Actors/ImageSearcher"; + + +new T("ImageSearcher", [ + [ + "Should find images", + () => { + const tags = new UIEventSource({ + "mapillary": "https://www.mapillary.com/app/?pKey=bYH6FFl8LXAPapz4PNSh3Q" + }); + const searcher = ImageSearcher.construct(tags) + const result = searcher.data[0]; + equal(result.url, "https://www.mapillary.com/map/im/bYH6FFl8LXAPapz4PNSh3Q"); + } + ] + + +]) \ No newline at end of file