"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const initTestEnvironment_1 = require("../../../../tests/utils/initTestEnvironment");
const getInfo_1 = require("../calls/getInfo");
const deploy_1 = require("../transactions/deploy");
const deployment_json_1 = __importDefault(require("../../../../tests/utils/deployment.json"));
describe('getInfo', () => {
    const shared = {};
    beforeAll(() => __awaiter(this, void 0, void 0, function* () {
        const env = yield initTestEnvironment_1.initTestEnvironment();
        shared.env = Object.assign({}, env, { deployment: deployment_json_1.default });
        shared.address = yield deploy_1.deployToken(shared.env);
    }));
    it('getInfo', () => __awaiter(this, void 0, void 0, function* () {
        const info = yield getInfo_1.getInfo(shared.env, shared.address);
        expect(info.symbol).toBe('FIXED');
        expect(info.name).toBe('Premined Token');
        expect(info.decimals).toBe(18);
        expect(info.totalSupply).toBe('1000000000000000000000000');
    }));
    it('Info gets overridden', () => __awaiter(this, void 0, void 0, function* () {
        const tokenAddress = yield deploy_1.deployToken(shared.env, 'TEST');
        const modifiedEnv = Object.assign({}, shared.env, { deployment: Object.assign({}, shared.env.deployment, { thirdPartyContracts: Object.assign({}, shared.env.deployment.thirdPartyContracts, { tokens: [
                        {
                            address: tokenAddress.toString(),
                            decimals: 18,
                            symbol: 'NOT-TEST',
                        },
                    ] }) }) });
        const info = yield getInfo_1.getInfo(modifiedEnv, tokenAddress);
        expect(info.symbol).toBe('NOT-TEST');
    }));
});
