Skip to content

[Assets.test.ts] Waves seeding to account2 is commented out causing failing test #50

@xucito

Description

@xucito

Test always fails as account2 is reset to a different seed then the one used for other assets in Assets.test.ts

        let account2 = "exchange test";

but then the account2s balance seeding is removed

   // GIVE WAVES TO TEST ACC
      // const transferTx = transfer({ recipient: address(account2, 'T'), amount: 100000000 }, MASTER_SEED)
      // await broadcast(transferTx, API_BASE)

Full function

    it(
      "Should perform exchange transaction",
      async () => {
        // ISSUE ASSET
        let account2 = "exchange test";
        let assetId: string;
        const txParams: IIssueParams = {
          name: "Test token",
          description: "no description",
          //decimals: 3,
          quantity: 100000000000,
          chainId: CHAIN_ID,
          reissuable: true
        };

        const issueTx = issue(txParams, account1);
        assetId = issueTx.id;
        await broadcast(issueTx, API_BASE);
        // GIVE WAVES TO TEST ACC
        // const transferTx = transfer({ recipient: address(account2, 'T'), amount: 100000000 }, MASTER_SEED)
        // await broadcast(transferTx, API_BASE)

        //WAIT BOTH TX TO COMPLETE
        await waitForTx(issueTx.id, { timeout: TIMEOUT, apiBase: API_BASE });
        // await waitForTx(transferTx.id, { timeout: TIMEOUT, apiBase: API_BASE })
        /////////////////////////

        //assetId = 'qmhEv7NeL39kDiWBVfzZh6aT1ZwzpD7y1CFxvmiH78U'

        const order1 = order(
          {
            //matcherPublicKey,
            matcherPublicKey: publicKey(account1),
            orderType: "buy",
            matcherFee: 300000,
            amountAsset: assetId,
            priceAsset: null,
            amount: 1,
            price: 100000000
          },
          account2
        );

        const order2 = order(
          {
            //matcherPublicKey,
            matcherPublicKey: publicKey(account1),
            orderType: "sell",
            matcherFee: 300000,
            amountAsset: assetId,
            priceAsset: null,
            amount: 1,
            price: 100000000
          },
          account1
        );

        //await submitOrder(order1, matcherUrl)
        //await submitOrder(order2, matcherUrl)

        const exchangeTx = exchange(
          {
            type: 7,
            version: 2,
            order1,
            order2,
            price: 100000000,
            amount: 1,
            buyMatcherFee: order1.matcherFee,
            sellMatcherFee: order2.matcherFee,
            timestamp: Date.now(),
            proofs: [],
            fee: 4000000,
            senderPublicKey: publicKey(account1)
          },
          account1
        );

        const resp = await broadcast(exchangeTx, API_BASE);
        expect(resp.type).toEqual(7);
      },
      TIMEOUT
    );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions