Skip to content

Commit

Permalink
Merge pull request #217 from ckb-cell/fix/208-jobs-delayed-count
Browse files Browse the repository at this point in the history
fix: incorrect count of delayed jobs in the enqueueTransaction test
  • Loading branch information
ahonn authored Sep 2, 2024
2 parents 38224cc + fd4d2be commit 32389cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PNPM
uses: pnpm/action-setup@v3
uses: pnpm/action-setup@v4
with:
version: 8
version: 9

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "21"
cache: "pnpm"
Expand Down
13 changes: 8 additions & 5 deletions test/services/transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,14 @@ describe('transactionProcessor', () => {
},
};

transactionProcessor.enqueueTransaction(transactionRequest);
const count = await transactionProcessor['queue'].getJobCounts();
const job = await transactionProcessor['queue'].getJob(transactionRequest.txid);
expect(count.delayed).toBe(1);
expect(job?.delay).toBe(cradle.env.TRANSACTION_QUEUE_JOB_DELAY);
await transactionProcessor.enqueueTransaction(transactionRequest);
const jobs = await transactionProcessor['queue'].getJobs('delayed');
const jobFromApi = await transactionProcessor['queue'].getJob(transactionRequest.txid);
const jobFromList = jobs.find((row) => row.id === transactionRequest.txid);

expect(jobFromApi).toBeDefined();
expect(jobFromApi!.id).toStrictEqual(jobFromList?.id);
expect(jobFromApi!.delay).toBe(cradle.env.TRANSACTION_QUEUE_JOB_DELAY);
});

test('retryMissingTransactions: should be retry transaction job when missing', async () => {
Expand Down

0 comments on commit 32389cb

Please sign in to comment.