Skip to content

Commit

Permalink
test: add some tests to show the interaction with the server without …
Browse files Browse the repository at this point in the history
…client
  • Loading branch information
antomor committed Mar 19, 2024
1 parent 109f032 commit 5573c73
Show file tree
Hide file tree
Showing 6 changed files with 857 additions and 35 deletions.
21 changes: 9 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"devDependencies": {
"@types/express": "^4.17.17",
"@types/sinon-chai": "^3.2.10",
"axios": "^1.6.7",
"sinon": "^16.0.0",
"sinon-chai": "^3.7.0"
}
Expand Down
25 changes: 2 additions & 23 deletions test/relayclient/RelayClient.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from 'chai';
import {
assertLog,
createSmartWalletFactory,
createSupportedSmartWallet,
deployContract,
Expand Down Expand Up @@ -28,7 +29,7 @@ import {
HttpClient,
HttpWrapper,
} from '@rsksmart/rif-relay-client';
import { constants, Contract, EventFilter, Wallet } from 'ethers';
import { constants, Wallet } from 'ethers';
import { ethers } from 'hardhat';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { loadConfiguration } from '../relayserver/ServerTestUtils';
Expand Down Expand Up @@ -82,28 +83,6 @@ class MockHttpClient extends HttpClient {
}
}

type AssertLogParams = {
filter: EventFilter;
hash?: string;
contract: Contract;
index: number;
value: unknown;
};

const assertLog = async ({
filter,
hash,
contract,
index,
value,
}: AssertLogParams) => {
const logs = await contract.queryFilter(filter);
const log = logs.find((x) => x.transactionHash === hash);

expect(log).to.not.be.undefined;
expect(log?.args?.at(index)).to.be.equal(value);
};

describe('RelayClient', function () {
let relayClient: RelayClient;
let relayServer: RelayServer;
Expand Down
Loading

0 comments on commit 5573c73

Please sign in to comment.