linter fixes

This commit is contained in:
jonny 2021-07-02 19:05:03 +02:00
parent 310e131a6e
commit 9bcdc9ba33
4 changed files with 108 additions and 108 deletions

View file

@ -1,6 +1,6 @@
import Axios from "axios"; import Axios from 'axios';
import { PUSHER_URL } from "../Enum/EnvironmentVariable"; import { PUSHER_URL } from '../Enum/EnvironmentVariable';
import type { CharacterTexture } from "./LocalUser"; import type { CharacterTexture } from './LocalUser';
export class MapDetail { export class MapDetail {
constructor(public readonly mapUrl: string, public readonly textures: CharacterTexture[] | undefined) {} constructor(public readonly mapUrl: string, public readonly textures: CharacterTexture[] | undefined) {}
@ -15,19 +15,19 @@ export class Room {
private _search: URLSearchParams; private _search: URLSearchParams;
constructor(id: string) { constructor(id: string) {
const url = new URL(id, "https://example.com"); const url = new URL(id, 'https://example.com');
this.id = url.pathname; this.id = url.pathname;
if (this.id.startsWith("/")) { if (this.id.startsWith('/')) {
this.id = this.id.substr(1); this.id = this.id.substr(1);
} }
if (this.id.startsWith("_/")) { if (this.id.startsWith('_/')) {
this.isPublic = true; this.isPublic = true;
} else if (this.id.startsWith("@/")) { } else if (this.id.startsWith('@/')) {
this.isPublic = false; this.isPublic = false;
} else { } else {
throw new Error("Invalid room ID"); throw new Error('Invalid room ID');
} }
this._search = new URLSearchParams(url.search); this._search = new URLSearchParams(url.search);
@ -38,16 +38,16 @@ export class Room {
baseUrl: string, baseUrl: string,
currentInstance: string currentInstance: string
): { roomId: string; hash: string | null } { ): { roomId: string; hash: string | null } {
let roomId = ""; let roomId = '';
let hash = null; let hash = null;
if (!identifier.startsWith("/_/") && !identifier.startsWith("/@/")) { if (!identifier.startsWith('/_/') && !identifier.startsWith('/@/')) {
//relative file link //relative file link
//Relative identifier can be deep enough to rewrite the base domain, so we cannot use the variable 'baseUrl' as the actual base url for the URL objects. //Relative identifier can be deep enough to rewrite the base domain, so we cannot use the variable 'baseUrl' as the actual base url for the URL objects.
//We instead use 'workadventure' as a dummy base value. //We instead use 'workadventure' as a dummy base value.
const baseUrlObject = new URL(baseUrl); const baseUrlObject = new URL(baseUrl);
const absoluteExitSceneUrl = new URL( const absoluteExitSceneUrl = new URL(
identifier, identifier,
"http://workadventure/_/" + currentInstance + "/" + baseUrlObject.hostname + baseUrlObject.pathname 'http://workadventure/_/' + currentInstance + '/' + baseUrlObject.hostname + baseUrlObject.pathname
); );
roomId = absoluteExitSceneUrl.pathname; //in case of a relative url, we need to create a public roomId roomId = absoluteExitSceneUrl.pathname; //in case of a relative url, we need to create a public roomId
roomId = roomId.substring(1); //remove the leading slash roomId = roomId.substring(1); //remove the leading slash
@ -58,7 +58,7 @@ export class Room {
} }
} else { } else {
//absolute room Id //absolute room Id
const parts = identifier.split("#"); const parts = identifier.split('#');
roomId = parts[0]; roomId = parts[0];
roomId = roomId.substring(1); //remove the leading slash roomId = roomId.substring(1); //remove the leading slash
if (parts.length > 1) { if (parts.length > 1) {
@ -78,7 +78,7 @@ export class Room {
if (this.isPublic) { if (this.isPublic) {
const match = /_\/[^/]+\/(.+)/.exec(this.id); const match = /_\/[^/]+\/(.+)/.exec(this.id);
if (!match) throw new Error('Could not extract url from "' + this.id + '"'); if (!match) throw new Error('Could not extract url from "' + this.id + '"');
this.mapUrl = window.location.protocol + "//" + match[1]; this.mapUrl = window.location.protocol + '//' + match[1];
resolve(new MapDetail(this.mapUrl, this.textures)); resolve(new MapDetail(this.mapUrl, this.textures));
return; return;
} else { } else {
@ -89,7 +89,7 @@ export class Room {
params: urlParts, params: urlParts,
}) })
.then(({ data }) => { .then(({ data }) => {
console.log("Map ", this.id, " resolves to URL ", data.mapUrl); console.log('Map ', this.id, ' resolves to URL ', data.mapUrl);
resolve(data); resolve(data);
return; return;
}) })
@ -118,7 +118,7 @@ export class Room {
} else { } else {
const match = /@\/([^/]+)\/([^/]+)\/.+/.exec(this.id); const match = /@\/([^/]+)\/([^/]+)\/.+/.exec(this.id);
if (!match) throw new Error('Could not extract instance from "' + this.id + '"'); if (!match) throw new Error('Could not extract instance from "' + this.id + '"');
this.instance = match[1] + "/" + match[2]; this.instance = match[1] + '/' + match[2];
return this.instance; return this.instance;
} }
} }
@ -127,7 +127,7 @@ export class Room {
const regex = /@\/([^/]+)\/([^/]+)(?:\/([^/]*))?/gm; const regex = /@\/([^/]+)\/([^/]+)(?:\/([^/]*))?/gm;
const match = regex.exec(url); const match = regex.exec(url);
if (!match) { if (!match) {
throw new Error("Invalid URL " + url); throw new Error('Invalid URL ' + url);
} }
const results: { organizationSlug: string; worldSlug: string; roomSlug?: string } = { const results: { organizationSlug: string; worldSlug: string; roomSlug?: string } = {
organizationSlug: match[1], organizationSlug: match[1],
@ -140,8 +140,8 @@ export class Room {
} }
public isDisconnected(): boolean { public isDisconnected(): boolean {
const alone = this._search.get("alone"); const alone = this._search.get('alone');
if (alone && alone !== "0" && alone.toLowerCase() !== "false") { if (alone && alone !== '0' && alone.toLowerCase() !== 'false') {
return true; return true;
} }
return false; return false;

View file

@ -1,10 +1,10 @@
import type { ITiledMapObject } from "../Map/ITiledMap"; import type { ITiledMapObject } from '../Map/ITiledMap';
import type { GameScene } from "../Game/GameScene"; import type { GameScene } from '../Game/GameScene';
export class TextUtils { export class TextUtils {
public static createTextFromITiledMapObject(scene: GameScene, object: ITiledMapObject): void { public static createTextFromITiledMapObject(scene: GameScene, object: ITiledMapObject): void {
if (object.text === undefined) { if (object.text === undefined) {
throw new Error("This object has not textual representation."); throw new Error('This object has not textual representation.');
} }
const options: { const options: {
fontStyle?: string; fontStyle?: string;
@ -18,18 +18,18 @@ export class TextUtils {
}; };
} = {}; } = {};
if (object.text.italic) { if (object.text.italic) {
options.fontStyle = "italic"; options.fontStyle = 'italic';
} }
// Note: there is no support for "strikeout" and "underline" // Note: there is no support for "strikeout" and "underline"
let fontSize: number = 16; let fontSize: number = 16;
if (object.text.pixelsize) { if (object.text.pixelsize) {
fontSize = object.text.pixelsize; fontSize = object.text.pixelsize;
} }
options.fontSize = fontSize + "px"; options.fontSize = fontSize + 'px';
if (object.text.fontfamily) { if (object.text.fontfamily) {
options.fontFamily = '"' + object.text.fontfamily + '"'; options.fontFamily = '"' + object.text.fontfamily + '"';
} }
let color = "#000000"; let color = '#000000';
if (object.text.color !== undefined) { if (object.text.color !== undefined) {
color = object.text.color; color = object.text.color;
} }

View file

@ -1,4 +1,4 @@
import { registeredCallbacks } from "./Api/iframe/registeredCallbacks"; import { registeredCallbacks } from './Api/iframe/registeredCallbacks';
import { import {
IframeResponseEvent, IframeResponseEvent,
IframeResponseEventMap, IframeResponseEventMap,
@ -6,19 +6,19 @@ import {
isIframeErrorAnswerEvent, isIframeErrorAnswerEvent,
isIframeResponseEventWrapper, isIframeResponseEventWrapper,
TypedMessageEvent, TypedMessageEvent,
} from "./Api/Events/IframeEvent"; } from './Api/Events/IframeEvent';
import chat from "./Api/iframe/chat"; import chat from './Api/iframe/chat';
import type { IframeCallback } from "./Api/iframe/IframeApiContribution"; import type { IframeCallback } from './Api/iframe/IframeApiContribution';
import nav from "./Api/iframe/nav"; import nav from './Api/iframe/nav';
import controls from "./Api/iframe/controls"; import controls from './Api/iframe/controls';
import ui from "./Api/iframe/ui"; import ui from './Api/iframe/ui';
import sound from "./Api/iframe/sound"; import sound from './Api/iframe/sound';
import room from "./Api/iframe/room"; import room from './Api/iframe/room';
import player from "./Api/iframe/player"; import player from './Api/iframe/player';
import type { ButtonDescriptor } from "./Api/iframe/Ui/ButtonDescriptor"; import type { ButtonDescriptor } from './Api/iframe/Ui/ButtonDescriptor';
import type { Popup } from "./Api/iframe/Ui/Popup"; import type { Popup } from './Api/iframe/Ui/Popup';
import type { Sound } from "./Api/iframe/Sound/Sound"; import type { Sound } from './Api/iframe/Sound/Sound';
import { answerPromises, sendToWorkadventure } from "./Api/iframe/IframeApiContribution"; import { answerPromises, sendToWorkadventure } from './Api/iframe/IframeApiContribution';
const wa = { const wa = {
ui, ui,
@ -36,7 +36,7 @@ const wa = {
* @deprecated Use WA.chat.sendChatMessage instead * @deprecated Use WA.chat.sendChatMessage instead
*/ */
sendChatMessage(message: string, author: string): void { sendChatMessage(message: string, author: string): void {
console.warn("Method WA.sendChatMessage is deprecated. Please use WA.chat.sendChatMessage instead"); console.warn('Method WA.sendChatMessage is deprecated. Please use WA.chat.sendChatMessage instead');
chat.sendChatMessage(message, author); chat.sendChatMessage(message, author);
}, },
@ -45,7 +45,7 @@ const wa = {
*/ */
disablePlayerControls(): void { disablePlayerControls(): void {
console.warn( console.warn(
"Method WA.disablePlayerControls is deprecated. Please use WA.controls.disablePlayerControls instead" 'Method WA.disablePlayerControls is deprecated. Please use WA.controls.disablePlayerControls instead'
); );
controls.disablePlayerControls(); controls.disablePlayerControls();
}, },
@ -55,7 +55,7 @@ const wa = {
*/ */
restorePlayerControls(): void { restorePlayerControls(): void {
console.warn( console.warn(
"Method WA.restorePlayerControls is deprecated. Please use WA.controls.restorePlayerControls instead" 'Method WA.restorePlayerControls is deprecated. Please use WA.controls.restorePlayerControls instead'
); );
controls.restorePlayerControls(); controls.restorePlayerControls();
}, },
@ -64,7 +64,7 @@ const wa = {
* @deprecated Use WA.ui.displayBubble instead * @deprecated Use WA.ui.displayBubble instead
*/ */
displayBubble(): void { displayBubble(): void {
console.warn("Method WA.displayBubble is deprecated. Please use WA.ui.displayBubble instead"); console.warn('Method WA.displayBubble is deprecated. Please use WA.ui.displayBubble instead');
ui.displayBubble(); ui.displayBubble();
}, },
@ -72,7 +72,7 @@ const wa = {
* @deprecated Use WA.ui.removeBubble instead * @deprecated Use WA.ui.removeBubble instead
*/ */
removeBubble(): void { removeBubble(): void {
console.warn("Method WA.removeBubble is deprecated. Please use WA.ui.removeBubble instead"); console.warn('Method WA.removeBubble is deprecated. Please use WA.ui.removeBubble instead');
ui.removeBubble(); ui.removeBubble();
}, },
@ -80,7 +80,7 @@ const wa = {
* @deprecated Use WA.nav.openTab instead * @deprecated Use WA.nav.openTab instead
*/ */
openTab(url: string): void { openTab(url: string): void {
console.warn("Method WA.openTab is deprecated. Please use WA.nav.openTab instead"); console.warn('Method WA.openTab is deprecated. Please use WA.nav.openTab instead');
nav.openTab(url); nav.openTab(url);
}, },
@ -88,7 +88,7 @@ const wa = {
* @deprecated Use WA.sound.loadSound instead * @deprecated Use WA.sound.loadSound instead
*/ */
loadSound(url: string): Sound { loadSound(url: string): Sound {
console.warn("Method WA.loadSound is deprecated. Please use WA.sound.loadSound instead"); console.warn('Method WA.loadSound is deprecated. Please use WA.sound.loadSound instead');
return sound.loadSound(url); return sound.loadSound(url);
}, },
@ -96,7 +96,7 @@ const wa = {
* @deprecated Use WA.nav.goToPage instead * @deprecated Use WA.nav.goToPage instead
*/ */
goToPage(url: string): void { goToPage(url: string): void {
console.warn("Method WA.goToPage is deprecated. Please use WA.nav.goToPage instead"); console.warn('Method WA.goToPage is deprecated. Please use WA.nav.goToPage instead');
nav.goToPage(url); nav.goToPage(url);
}, },
@ -104,15 +104,15 @@ const wa = {
* @deprecated Use WA.nav.goToRoom instead * @deprecated Use WA.nav.goToRoom instead
*/ */
goToRoom(url: string): void { goToRoom(url: string): void {
console.warn("Method WA.goToRoom is deprecated. Please use WA.nav.goToRoom instead"); console.warn('Method WA.goToRoom is deprecated. Please use WA.nav.goToRoom instead');
nav.goToRoom(url); nav.goToRoom(url);
}, },
/** /**
* @deprecated Use WA.nav.openCoWebSite instead * @deprecated Use WA.nav.openCoWebSite instead
*/ */
openCoWebSite(url: string, allowApi: boolean = false, allowPolicy: string = ""): void { openCoWebSite(url: string, allowApi: boolean = false, allowPolicy: string = ''): void {
console.warn("Method WA.openCoWebSite is deprecated. Please use WA.nav.openCoWebSite instead"); console.warn('Method WA.openCoWebSite is deprecated. Please use WA.nav.openCoWebSite instead');
nav.openCoWebSite(url, allowApi, allowPolicy); nav.openCoWebSite(url, allowApi, allowPolicy);
}, },
@ -120,7 +120,7 @@ const wa = {
* @deprecated Use WA.nav.closeCoWebSite instead * @deprecated Use WA.nav.closeCoWebSite instead
*/ */
closeCoWebSite(): void { closeCoWebSite(): void {
console.warn("Method WA.closeCoWebSite is deprecated. Please use WA.nav.closeCoWebSite instead"); console.warn('Method WA.closeCoWebSite is deprecated. Please use WA.nav.closeCoWebSite instead');
nav.closeCoWebSite(); nav.closeCoWebSite();
}, },
@ -128,28 +128,28 @@ const wa = {
* @deprecated Use WA.controls.restorePlayerControls instead * @deprecated Use WA.controls.restorePlayerControls instead
*/ */
openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup { openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup {
console.warn("Method WA.openPopup is deprecated. Please use WA.ui.openPopup instead"); console.warn('Method WA.openPopup is deprecated. Please use WA.ui.openPopup instead');
return ui.openPopup(targetObject, message, buttons); return ui.openPopup(targetObject, message, buttons);
}, },
/** /**
* @deprecated Use WA.chat.onChatMessage instead * @deprecated Use WA.chat.onChatMessage instead
*/ */
onChatMessage(callback: (message: string) => void): void { onChatMessage(callback: (message: string) => void): void {
console.warn("Method WA.onChatMessage is deprecated. Please use WA.chat.onChatMessage instead"); console.warn('Method WA.onChatMessage is deprecated. Please use WA.chat.onChatMessage instead');
chat.onChatMessage(callback); chat.onChatMessage(callback);
}, },
/** /**
* @deprecated Use WA.room.onEnterZone instead * @deprecated Use WA.room.onEnterZone instead
*/ */
onEnterZone(name: string, callback: () => void): void { onEnterZone(name: string, callback: () => void): void {
console.warn("Method WA.onEnterZone is deprecated. Please use WA.room.onEnterZone instead"); console.warn('Method WA.onEnterZone is deprecated. Please use WA.room.onEnterZone instead');
room.onEnterZone(name, callback); room.onEnterZone(name, callback);
}, },
/** /**
* @deprecated Use WA.room.onLeaveZone instead * @deprecated Use WA.room.onLeaveZone instead
*/ */
onLeaveZone(name: string, callback: () => void): void { onLeaveZone(name: string, callback: () => void): void {
console.warn("Method WA.onLeaveZone is deprecated. Please use WA.room.onLeaveZone instead"); console.warn('Method WA.onLeaveZone is deprecated. Please use WA.room.onLeaveZone instead');
room.onLeaveZone(name, callback); room.onLeaveZone(name, callback);
}, },
}; };
@ -166,7 +166,7 @@ declare global {
window.WA = wa; window.WA = wa;
window.addEventListener( window.addEventListener(
"message", 'message',
<T extends keyof IframeResponseEventMap>(message: TypedMessageEvent<IframeResponseEvent<T>>) => { <T extends keyof IframeResponseEventMap>(message: TypedMessageEvent<IframeResponseEvent<T>>) => {
if (message.source !== window.parent) { if (message.source !== window.parent) {
return; // Skip message in this event listener return; // Skip message in this event listener
@ -181,7 +181,7 @@ window.addEventListener(
const resolver = answerPromises.get(queryId); const resolver = answerPromises.get(queryId);
if (resolver === undefined) { if (resolver === undefined) {
throw new Error("In Iframe API, got an answer for a question that we have no track of."); throw new Error('In Iframe API, got an answer for a question that we have no track of.');
} }
resolver.resolve(payloadData); resolver.resolve(payloadData);
@ -192,7 +192,7 @@ window.addEventListener(
const resolver = answerPromises.get(queryId); const resolver = answerPromises.get(queryId);
if (resolver === undefined) { if (resolver === undefined) {
throw new Error("In Iframe API, got an error answer for a question that we have no track of."); throw new Error('In Iframe API, got an error answer for a question that we have no track of.');
} }
resolver.reject(payloadError); resolver.reject(payloadError);

View file

@ -1,89 +1,89 @@
import "jasmine"; import 'jasmine';
import { Room } from "../../../src/Connexion/Room"; import { Room } from '../../../src/Connexion/Room';
describe("Room getIdFromIdentifier()", () => { describe('Room getIdFromIdentifier()', () => {
it("should work with an absolute room id and no hash as parameter", () => { it('should work with an absolute room id and no hash as parameter', () => {
const { roomId, hash } = Room.getIdFromIdentifier("/_/global/maps.workadventu.re/test2.json", "", ""); const { roomId, hash } = Room.getIdFromIdentifier('/_/global/maps.workadventu.re/test2.json', '', '');
expect(roomId).toEqual("_/global/maps.workadventu.re/test2.json"); expect(roomId).toEqual('_/global/maps.workadventu.re/test2.json');
expect(hash).toEqual(null); expect(hash).toEqual(null);
}); });
it("should work with an absolute room id and a hash as parameters", () => { it('should work with an absolute room id and a hash as parameters', () => {
const { roomId, hash } = Room.getIdFromIdentifier("/_/global/maps.workadventu.re/test2.json#start", "", ""); const { roomId, hash } = Room.getIdFromIdentifier('/_/global/maps.workadventu.re/test2.json#start', '', '');
expect(roomId).toEqual("_/global/maps.workadventu.re/test2.json"); expect(roomId).toEqual('_/global/maps.workadventu.re/test2.json');
expect(hash).toEqual("start"); expect(hash).toEqual('start');
}); });
it("should work with an absolute room id, regardless of baseUrl or instance", () => { it('should work with an absolute room id, regardless of baseUrl or instance', () => {
const { roomId, hash } = Room.getIdFromIdentifier( const { roomId, hash } = Room.getIdFromIdentifier(
"/_/global/maps.workadventu.re/test2.json", '/_/global/maps.workadventu.re/test2.json',
"https://another.domain/_/global/test.json", 'https://another.domain/_/global/test.json',
"lol" 'lol'
); );
expect(roomId).toEqual("_/global/maps.workadventu.re/test2.json"); expect(roomId).toEqual('_/global/maps.workadventu.re/test2.json');
expect(hash).toEqual(null); expect(hash).toEqual(null);
}); });
it("should work with a relative file link and no hash as parameters", () => { it('should work with a relative file link and no hash as parameters', () => {
const { roomId, hash } = Room.getIdFromIdentifier( const { roomId, hash } = Room.getIdFromIdentifier(
"./test2.json", './test2.json',
"https://maps.workadventu.re/test.json", 'https://maps.workadventu.re/test.json',
"global" 'global'
); );
expect(roomId).toEqual("_/global/maps.workadventu.re/test2.json"); expect(roomId).toEqual('_/global/maps.workadventu.re/test2.json');
expect(hash).toEqual(null); expect(hash).toEqual(null);
}); });
it("should work with a relative file link with no dot", () => { it('should work with a relative file link with no dot', () => {
const { roomId, hash } = Room.getIdFromIdentifier( const { roomId, hash } = Room.getIdFromIdentifier(
"test2.json", 'test2.json',
"https://maps.workadventu.re/test.json", 'https://maps.workadventu.re/test.json',
"global" 'global'
); );
expect(roomId).toEqual("_/global/maps.workadventu.re/test2.json"); expect(roomId).toEqual('_/global/maps.workadventu.re/test2.json');
expect(hash).toEqual(null); expect(hash).toEqual(null);
}); });
it("should work with a relative file link two levels deep", () => { it('should work with a relative file link two levels deep', () => {
const { roomId, hash } = Room.getIdFromIdentifier( const { roomId, hash } = Room.getIdFromIdentifier(
"../floor1/Floor1.json", '../floor1/Floor1.json',
"https://maps.workadventu.re/floor0/Floor0.json", 'https://maps.workadventu.re/floor0/Floor0.json',
"global" 'global'
); );
expect(roomId).toEqual("_/global/maps.workadventu.re/floor1/Floor1.json"); expect(roomId).toEqual('_/global/maps.workadventu.re/floor1/Floor1.json');
expect(hash).toEqual(null); expect(hash).toEqual(null);
}); });
it("should work with a relative file link that rewrite the map domain", () => { it('should work with a relative file link that rewrite the map domain', () => {
const { roomId, hash } = Room.getIdFromIdentifier( const { roomId, hash } = Room.getIdFromIdentifier(
"../../maps.workadventure.localhost/Floor1/floor1.json", '../../maps.workadventure.localhost/Floor1/floor1.json',
"https://maps.workadventu.re/floor0/Floor0.json", 'https://maps.workadventu.re/floor0/Floor0.json',
"global" 'global'
); );
expect(roomId).toEqual("_/global/maps.workadventure.localhost/Floor1/floor1.json"); expect(roomId).toEqual('_/global/maps.workadventure.localhost/Floor1/floor1.json');
expect(hash).toEqual(null); expect(hash).toEqual(null);
}); });
it("should work with a relative file link that rewrite the map instance", () => { it('should work with a relative file link that rewrite the map instance', () => {
const { roomId, hash } = Room.getIdFromIdentifier( const { roomId, hash } = Room.getIdFromIdentifier(
"../../../notglobal/maps.workadventu.re/Floor1/floor1.json", '../../../notglobal/maps.workadventu.re/Floor1/floor1.json',
"https://maps.workadventu.re/floor0/Floor0.json", 'https://maps.workadventu.re/floor0/Floor0.json',
"global" 'global'
); );
expect(roomId).toEqual("_/notglobal/maps.workadventu.re/Floor1/floor1.json"); expect(roomId).toEqual('_/notglobal/maps.workadventu.re/Floor1/floor1.json');
expect(hash).toEqual(null); expect(hash).toEqual(null);
}); });
it("should work with a relative file link that change the map type", () => { it('should work with a relative file link that change the map type', () => {
const { roomId, hash } = Room.getIdFromIdentifier( const { roomId, hash } = Room.getIdFromIdentifier(
"../../../../@/tcm/is/great", '../../../../@/tcm/is/great',
"https://maps.workadventu.re/floor0/Floor0.json", 'https://maps.workadventu.re/floor0/Floor0.json',
"global" 'global'
); );
expect(roomId).toEqual("@/tcm/is/great"); expect(roomId).toEqual('@/tcm/is/great');
expect(hash).toEqual(null); expect(hash).toEqual(null);
}); });
it("should work with a relative file link and a hash as parameters", () => { it('should work with a relative file link and a hash as parameters', () => {
const { roomId, hash } = Room.getIdFromIdentifier( const { roomId, hash } = Room.getIdFromIdentifier(
"./test2.json#start", './test2.json#start',
"https://maps.workadventu.re/test.json", 'https://maps.workadventu.re/test.json',
"global" 'global'
); );
expect(roomId).toEqual("_/global/maps.workadventu.re/test2.json"); expect(roomId).toEqual('_/global/maps.workadventu.re/test2.json');
expect(hash).toEqual("start"); expect(hash).toEqual('start');
}); });
}); });