forked from MapComplete/MapComplete
Fix tests
This commit is contained in:
parent
8aa06a4e5e
commit
47e3c6dd80
2 changed files with 3 additions and 3 deletions
|
@ -51,6 +51,7 @@ export class WikimediaImageProvider extends ImageProvider {
|
||||||
*
|
*
|
||||||
* WikimediaImageProvider.extractFileName("https://commons.wikimedia.org/wiki/File:Somefile.jpg") // => "Somefile.jpg"
|
* WikimediaImageProvider.extractFileName("https://commons.wikimedia.org/wiki/File:Somefile.jpg") // => "Somefile.jpg"
|
||||||
* WikimediaImageProvider.extractFileName("https://commons.wikimedia.org/wiki/File:S%C3%A8vres%20-%20square_madame_de_Pompadour_-_bo%C3%AEte_%C3%A0_livres.jpg?uselang=en") // => "Sèvres_-_square_madame_de_Pompadour_-_boîte_à_livres.jpg"
|
* WikimediaImageProvider.extractFileName("https://commons.wikimedia.org/wiki/File:S%C3%A8vres%20-%20square_madame_de_Pompadour_-_bo%C3%AEte_%C3%A0_livres.jpg?uselang=en") // => "Sèvres_-_square_madame_de_Pompadour_-_boîte_à_livres.jpg"
|
||||||
|
* WikimediaImageProvider.extractFileName("https://upload.wikimedia.org/wikipedia/commons/thumb/e/e2/Edinburgh_City_police_box_001.jpg/576px-Edinburgh_City_police_box_001.jpg")// => "Edinburgh_City_police_box_001.jpg"
|
||||||
*/
|
*/
|
||||||
public static extractFileName(url: string) {
|
public static extractFileName(url: string) {
|
||||||
if (!url.startsWith("http")) {
|
if (!url.startsWith("http")) {
|
||||||
|
@ -146,9 +147,7 @@ export class WikimediaImageProvider extends ImageProvider {
|
||||||
* const result = await WikimediaImageProvider.singleton.ExtractUrls("wikimedia_commons", "File:Sèvres_-_square_madame_de_Pompadour_-_boîte_à_livres.jpg")
|
* const result = await WikimediaImageProvider.singleton.ExtractUrls("wikimedia_commons", "File:Sèvres_-_square_madame_de_Pompadour_-_boîte_à_livres.jpg")
|
||||||
* result[0].url_hd // => "https://commons.wikimedia.org/wiki/Special:FilePath/File%3AS%C3%A8vres_-_square_madame_de_Pompadour_-_bo%C3%AEte_%C3%A0_livres.jpg"
|
* result[0].url_hd // => "https://commons.wikimedia.org/wiki/Special:FilePath/File%3AS%C3%A8vres_-_square_madame_de_Pompadour_-_bo%C3%AEte_%C3%A0_livres.jpg"
|
||||||
*
|
*
|
||||||
* const result = await WikimediaImageProvider.singleton.ExtractUrls("image", "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e2/Edinburgh_City_police_box_001.jpg/576px-Edinburgh_City_police_box_001.jpg")
|
*/
|
||||||
* result[0].url_hd // => "https://commons.wikimedia.org/wiki/File:Edinburgh_City_police_box_001.jpg"
|
|
||||||
*/
|
|
||||||
public async ExtractUrls(key: string, value: string): undefined | Promise<ProvidedImage[]> {
|
public async ExtractUrls(key: string, value: string): undefined | Promise<ProvidedImage[]> {
|
||||||
const hasCommonsPrefix = WikimediaImageProvider.startsWithCommonsPrefix(value)
|
const hasCommonsPrefix = WikimediaImageProvider.startsWithCommonsPrefix(value)
|
||||||
if (key !== undefined && key !== this.commons_key && !hasCommonsPrefix) {
|
if (key !== undefined && key !== this.commons_key && !hasCommonsPrefix) {
|
||||||
|
|
|
@ -167,6 +167,7 @@ describe("PrepareTheme", () => {
|
||||||
description: "A testing theme",
|
description: "A testing theme",
|
||||||
icon: "",
|
icon: "",
|
||||||
id: "",
|
id: "",
|
||||||
|
icon: "./assets/whatever",
|
||||||
layers: [
|
layers: [
|
||||||
"layer-example",
|
"layer-example",
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue