/* eslint-disable */
const { doReplacement: actualDoReplacement } = require("./blueprintReplacementPlugin");

function doReplacement(request, files) {
    const result = {
        request: request,
        context: "c:\\",
    };
    actualDoReplacement(
        result,
        () => {},
        {},
        file => {
            console.log(file);
            return files && files.includes(file.replace("c:\\blueprints\\blue\\src\\", ""));
        },
        "blue",
    );
    return result.request;
}

test("Should not replace basic file", () => {
    const result = doReplacement("@insite/client-framework/component");
    expect(result).toBe("@insite/client-framework/component");
});

test("Should not replace basic mobius file with no override", () => {
    const result = doReplacement("@insite/mobius/Button");
    expect(result).toBe("@insite/mobius/Button");
});

test("Should replace basic mobius file with override", () => {
    const result = doReplacement("@insite/mobius/Button", ["MobiusOverrides\\Button.tsx"]);
    expect(result).toBe("../../blueprints/blue/src/MobiusOverrides/Button");
});

test("Should replace basic mobius file with override in subfolder", () => {
    const result = doReplacement("@insite/mobius/Button/Child", ["MobiusOverrides\\Button\\Child.tsx"]);
    expect(result).toBe("../../blueprints/blue/src/MobiusOverrides/Button/Child");
});
