Skip to content

Commit

Permalink
Update __tests__/rpcProvider.test.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Petar Penović <pp@spaceshard.io>
  • Loading branch information
tabaktoni and penovicp authored Jun 11, 2024
1 parent bf95bbc commit 7d5065e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions __tests__/rpcProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ describeIfRpc('RPCProvider', () => {
});

test('instantiate from rpcProvider', () => {
// instantiate rpc provider template
const newInsRPCProvider = new RpcProvider();
// like* change channel and parser
newInsRPCProvider.channel = rpcProvider.channel;
newInsRPCProvider.responseParser = rpcProvider.responseParser;
// instantiate from modified instance
const FinalInsRPCProvider = new RpcProvider(newInsRPCProvider);
expect(FinalInsRPCProvider).toBeInstanceOf(RpcProvider);

let FinalInsRPCProvider = new RpcProvider(newInsRPCProvider);
expect(FinalInsRPCProvider.channel).toBe(newInsRPCProvider.channel);
expect(FinalInsRPCProvider.responseParser).toBe(newInsRPCProvider.responseParser);

delete (newInsRPCProvider as any).responseParser;
FinalInsRPCProvider = new RpcProvider(newInsRPCProvider);
expect(FinalInsRPCProvider.channel).toBe(newInsRPCProvider.channel);
expect(FinalInsRPCProvider.responseParser).toBeInstanceOf(RPCResponseParser);
});

test('getChainId', async () => {
Expand Down

0 comments on commit 7d5065e

Please sign in to comment.