From bff99c87fa07dea88ce56031e002563096a42664 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 13 Nov 2023 08:46:16 -0800 Subject: [PATCH] Remove pkey used in tests (#1102) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * remove pkey used in tests * Update main/test/wallet-backend.test.js Co-authored-by: Miroslav Bajtoš --------- Co-authored-by: Miroslav Bajtoš --- .github/workflows/ci.yml | 2 ++ main/test/wallet-backend.test.js | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ccfccf52d..8a51cf094 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,6 +90,8 @@ jobs: - name: Test backend run: npm run test:backend + env: + TEST_SEED_PHRASE: ${{ secrets.TEST_SEED_PHRASE }} - name: Test frontend run: npm run test:ui diff --git a/main/test/wallet-backend.test.js b/main/test/wallet-backend.test.js index b3b1d760d..4051c43c0 100644 --- a/main/test/wallet-backend.test.js +++ b/main/test/wallet-backend.test.js @@ -4,6 +4,8 @@ const { WalletBackend } = require('../wallet-backend') const assert = require('assert').strict const { ethers } = require('ethers') +const { TEST_SEED_PHRASE } = process.env + const randomSeed = () => { const wallet = ethers.Wallet.createRandom() const seed = wallet.mnemonic.phrase @@ -46,13 +48,11 @@ describe('Wallet Backend', function () { describe('fetchAllTransactions()', function () { it('fetches all transactions', /** @this {Mocha.Test} */ async function () { + // We need a seed for a wallet that already has some transactions + if (!TEST_SEED_PHRASE) return this.skip() this.timeout(20_000) - await backend.setup( - // Here we want a seed for a wallet that already has some transactions - // eslint-disable-next-line max-len - 'insane believe defy best among myself mistake account paddle episode life music fame impact below define habit rotate clay innocent history depart slice series' - ) + await backend.setup(TEST_SEED_PHRASE) await pRetry(() => backend.fetchAllTransactions(), { retries: 10 }) assert.notStrictEqual(backend.transactions.length, 0, 'has transactions') for (const tx of backend.transactions) { @@ -67,7 +67,7 @@ describe('Wallet Backend', function () { describe('fetchScheduledRewards()', function () { it('fetches rewards scheduled for disbursement', async function () { - // We want a random wallet that doesn't have any scheduled rewards + // We need a new wallet that doesn't have any scheduled rewards await backend.setup(randomSeed()) const amount = await pRetry( () => backend.fetchScheduledRewards(),