"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());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const token_math_1 = require("@melonproject/token-math");
const initTestEnvironment_1 = require("../../../tests/utils/initTestEnvironment");
const update_1 = require("./update");
const deployTestingPriceFeed_1 = require("./deployTestingPriceFeed");
const deploy_1 = require("../../dependencies/token/transactions/deploy");
const getToken_1 = require("../../dependencies/token/calls/getToken");
describe('update', () => {
    const shared = {};
    beforeAll(() => __awaiter(this, void 0, void 0, function* () {
        shared.env = yield initTestEnvironment_1.initTestEnvironment();
        shared.quoteToken = yield getToken_1.getToken(shared.env, yield deploy_1.deployToken(shared.env, 'WETH'));
        shared.mlnToken = yield getToken_1.getToken(shared.env, yield deploy_1.deployToken(shared.env, 'MLN'));
        shared.address = yield deployTestingPriceFeed_1.deployTestingPriceFeed(shared.env, shared.quoteToken);
    }));
    it('update', () => __awaiter(this, void 0, void 0, function* () {
        const newPrice = token_math_1.createPrice(token_math_1.createQuantity(shared.mlnToken, 1), token_math_1.createQuantity(shared.quoteToken, 0.34));
        const receipt = yield update_1.update(shared.env, shared.address, [newPrice]);
        expect(token_math_1.isEqual(receipt[0], newPrice)).toBe(true);
    }));
});
