import { vCarousel } from "../src/vCarousel"; const errors=require("../src/errors.js"); describe("vCarousel", () => { let vCarouselTest : vCarousel; const videosWebDir="hhttp://localhost:9876/videos"; const fixture="
"; beforeEach(() => { vCarouselTest=new vCarousel(); document.body.insertAdjacentHTML('afterbegin', fixture); }); afterEach(() => { document.body.removeChild(document.getElementById('fixture')); }); it("Doit être une instance de vCarousel", () => { expect(vCarouselTest).toBeInstanceOf(vCarousel); }); describe("Configuration de vCarousel", () => { it("Doit générer une erreur si tous les ids passés ne correspondent pas à des éléments HTML existants.", () => { expect(() => { return vCarouselTest.vContainers=["dontExistId","video1","video2"]; }).toThrowError(errors.elementNotFound+"dontExistId"); expect(() => { return vCarouselTest.vContainers=["video1","dontExistId","video2"]; }).toThrowError(errors.elementNotFound+"dontExistId"); expect(() => { return vCarouselTest.vContainers=["video1","video2","dontExistId"]; }).toThrowError(errors.elementNotFound+"dontExistId"); }); it("Doit générer une erreur si tous les ids passés ne correspondent pas à des éléments HTML contenant une balise