2021-01-14 11:38:20 +01:00
|
|
|
import "jasmine";
|
2021-07-30 09:38:28 +02:00
|
|
|
import { getRessourceDescriptor } from "../../../src/Phaser/Entity/PlayerTexturesLoadingManager";
|
2021-01-14 11:38:20 +01:00
|
|
|
|
|
|
|
describe("getRessourceDescriptor()", () => {
|
|
|
|
it(", if given a valid descriptor as parameter, should return it", () => {
|
2021-07-30 09:38:28 +02:00
|
|
|
const desc = getRessourceDescriptor({ name: "name", img: "url" });
|
|
|
|
expect(desc.name).toEqual("name");
|
|
|
|
expect(desc.img).toEqual("url");
|
2021-01-14 11:38:20 +01:00
|
|
|
});
|
|
|
|
|
2021-07-27 14:29:09 +02:00
|
|
|
it(", if given a string as parameter, should search through hardcoded values", () => {
|
2021-07-30 09:38:28 +02:00
|
|
|
const desc = getRessourceDescriptor("male1");
|
|
|
|
expect(desc.name).toEqual("male1");
|
2021-01-14 11:38:20 +01:00
|
|
|
expect(desc.img).toEqual("resources/characters/pipoya/Male 01-1.png");
|
|
|
|
});
|
|
|
|
|
2021-07-27 14:29:09 +02:00
|
|
|
it(", if given a string as parameter, should search through hardcoded values (bis)", () => {
|
2021-07-30 09:38:28 +02:00
|
|
|
const desc = getRessourceDescriptor("color_2");
|
|
|
|
expect(desc.name).toEqual("color_2");
|
2021-01-14 11:38:20 +01:00
|
|
|
expect(desc.img).toEqual("resources/customisation/character_color/character_color1.png");
|
|
|
|
});
|
|
|
|
|
2021-07-27 14:29:09 +02:00
|
|
|
it(", if given a descriptor without url as parameter, should search through hardcoded values", () => {
|
2021-07-30 09:38:28 +02:00
|
|
|
const desc = getRessourceDescriptor({ name: "male1", img: "" });
|
|
|
|
expect(desc.name).toEqual("male1");
|
2021-01-14 11:38:20 +01:00
|
|
|
expect(desc.img).toEqual("resources/characters/pipoya/Male 01-1.png");
|
|
|
|
});
|
2021-07-30 09:38:28 +02:00
|
|
|
});
|