"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const gomod = require("../../../../../deploy/functions/runtimes/golang/gomod");
const go = require("../../../../../deploy/functions/runtimes/golang");
const MOD_NAME = "acme.com/fucntions";
const GO_VERSION = "1.13";
const FUNCTIONS_MOD = "firebase.google.com/firebase-functions-go";
const MIN_MODULE = `module ${MOD_NAME}

go ${GO_VERSION}
`;
const INLINE_MODULE = `${MIN_MODULE}
require ${go.ADMIN_SDK} v4.6.0 // indirect

replace ${FUNCTIONS_MOD} => ${go.FUNCTIONS_SDK}
`;
const BLOCK_MODULE = `${MIN_MODULE}

require (
  ${go.ADMIN_SDK} v4.6.0 // indirect
)

replace (
  ${FUNCTIONS_MOD} => ${go.FUNCTIONS_SDK}
)
`;
describe("Modules", () => {
    it("Should parse a bare minimum module", () => {
        const mod = gomod.parseModule(MIN_MODULE);
        (0, chai_1.expect)(mod.module).to.equal(MOD_NAME);
        (0, chai_1.expect)(mod.version).to.equal(GO_VERSION);
    });
    it("Should parse inline statements", () => {
        const mod = gomod.parseModule(INLINE_MODULE);
        (0, chai_1.expect)(mod.module).to.equal(MOD_NAME);
        (0, chai_1.expect)(mod.version).to.equal(GO_VERSION);
        (0, chai_1.expect)(mod.dependencies).to.deep.equal({
            [go.ADMIN_SDK]: "v4.6.0",
        });
        (0, chai_1.expect)(mod.replaces).to.deep.equal({
            [FUNCTIONS_MOD]: go.FUNCTIONS_SDK,
        });
    });
    it("Should parse block statements", () => {
        const mod = gomod.parseModule(BLOCK_MODULE);
        (0, chai_1.expect)(mod.module).to.equal(MOD_NAME);
        (0, chai_1.expect)(mod.version).to.equal(GO_VERSION);
        (0, chai_1.expect)(mod.dependencies).to.deep.equal({
            [go.ADMIN_SDK]: "v4.6.0",
        });
        (0, chai_1.expect)(mod.replaces).to.deep.equal({
            [FUNCTIONS_MOD]: go.FUNCTIONS_SDK,
        });
    });
});
//# sourceMappingURL=gomod.spec.js.map