import chai from "chai";
import freshy from "freshy";
import sinon from "sinon";
import config from "./config";

chai.should();

let result = null;

describe("When I use the makes module", () => {
    describe("to get car makes", () => {
        before(() => {
            sinon.stub(config, "getPath").returns("./test-makes.json");
            result = freshy.freshy("./makes").get("cars");
        });
        describe("the result", () => {
            it("is a list of car makes", () => {
                result[0].name.should.equal("CarMake1");
                result[1].name.should.equal("CarMake2");
                result[2].name.should.equal("CarMake3");
            });
        });
        after(() => config.getPath.restore());
    });
});