Fix tests

This commit is contained in:
Pieter Vander Vennet 2025-07-05 05:16:46 +02:00
parent 8aa06a4e5e
commit 47e3c6dd80
2 changed files with 3 additions and 3 deletions

View file

@ -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: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) {
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")
* 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[]> {
const hasCommonsPrefix = WikimediaImageProvider.startsWithCommonsPrefix(value)
if (key !== undefined && key !== this.commons_key && !hasCommonsPrefix) {

View file

@ -167,6 +167,7 @@ describe("PrepareTheme", () => {
description: "A testing theme",
icon: "",
id: "",
icon: "./assets/whatever",
layers: [
"layer-example",
{