Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xucito opened this issue Jan 23, 2020 · 0 comments

Comments

@xucito
Copy link

xucito commented Jan 23, 2020

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
    );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant