import chai from "chai";
import "mocha";
import Mapping from "../../src/domain/Mapping";
import WebSite from "../../src/domain/WebSite";

const expect = chai.expect;

describe("WebSite", () => {

    it("should store name, and mappingList should be empty", () => {
        const m = new WebSite("site", "site.com");
        expect(m.name).to.equal("site");
        expect(m.mappingList).to.have.lengthOf(0);
    });

    it("should add a mapping with mapping object", () => {
        const m = new WebSite("site", "site.com");
        const mapping: Mapping = {
            match: {
                event: "click",
                css: "body",
            },
            output: {
                prefix: "click",
            },
        };
        m.addMapping(mapping);
        expect(m.mappingList).to.have.lengthOf(1);
    });

    it("should add mappingList", () => {
        const m = new WebSite("site", "site.com");
        m.addMappingList([{
            match: {
                event: "click",
                css: "body",
            },
            output: {
                prefix: "click",
            },
        }]);
        expect(m.mappingList).to.have.lengthOf(1);
    });
});
