-
Notifications
You must be signed in to change notification settings - Fork 5k
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
add test coverage to web3-core #7091
Changes from 4 commits
dbeec51
c5d47f8
eab5a68
3246f82
c1a51a5
90ec3ec
e6c6485
db1a4a9
26e094f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,6 @@ import { | |
Web3APISpec, | ||
} from 'web3-types'; | ||
import { jsonRpc } from 'web3-utils'; | ||
import { SubscriptionError } from 'web3-errors'; | ||
|
||
// eslint-disable-next-line import/no-cycle | ||
import { Web3SubscriptionManager } from './web3_subscription_manager.js'; | ||
|
@@ -82,16 +81,6 @@ export abstract class Web3Subscription< | |
super(); | ||
const { requestManager } = options as { requestManager: Web3RequestManager<API> }; | ||
const { subscriptionManager } = options as { subscriptionManager: Web3SubscriptionManager }; | ||
if (requestManager && subscriptionManager) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed, in the constructor |
||
throw new SubscriptionError( | ||
'Only requestManager or subscriptionManager should be provided at Subscription constructor', | ||
); | ||
} | ||
if (!requestManager && !subscriptionManager) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed, in the constructor |
||
throw new SubscriptionError( | ||
'Either requestManager or subscriptionManager should be provided at Subscription constructor', | ||
); | ||
} | ||
if (requestManager) { | ||
// eslint-disable-next-line deprecation/deprecation | ||
this._subscriptionManager = new Web3SubscriptionManager(requestManager, {}, true); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
This file is part of web3.js. | ||
|
||
web3.js is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
web3.js is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with web3.js. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { BaseTransaction, TxValuesArray, AccessListEIP2930ValuesArray, FeeMarketEIP1559ValuesArray, JsonTx } from 'web3-eth-accounts'; | ||
|
||
export class CustomTransactionType extends BaseTransaction<unknown> { | ||
// eslint-disable-next-line class-methods-use-this | ||
public getUpfrontCost(): bigint { | ||
throw new Error('Method not implemented.'); | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
public raw(): TxValuesArray | AccessListEIP2930ValuesArray | FeeMarketEIP1559ValuesArray { | ||
throw new Error('Method not implemented.'); | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
public serialize(): Uint8Array { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public getMessageToSign(hashMessage: false): Uint8Array | Uint8Array[]; | ||
public getMessageToSign(hashMessage?: true | undefined): Uint8Array; | ||
// eslint-disable-next-line class-methods-use-this | ||
public getMessageToSign(): Uint8Array | Uint8Array[] { | ||
throw new Error('Method not implemented.'); | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
public hash(): Uint8Array { | ||
throw new Error('Method not implemented.'); | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
public getMessageToVerifySignature(): Uint8Array { | ||
throw new Error('Method not implemented.'); | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
public getSenderPublicKey(): Uint8Array { | ||
throw new Error('Method not implemented.'); | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
public toJSON(): JsonTx { | ||
throw new Error('Method not implemented.'); | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
protected _processSignature(): unknown { | ||
throw new Error('Method not implemented.'); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility, class-methods-use-this | ||
public errorStr(): string { | ||
throw new Error('Method not implemented.'); | ||
} | ||
// eslint-disable-next-line class-methods-use-this | ||
protected _errorMsg(): string { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
This file is part of web3.js. | ||
|
||
web3.js is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
web3.js is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
|
||
You should have received a copy of the GNU Lesser General Public License | ||
along with web3.js. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { Web3Subscription } from '../../../src'; | ||
|
||
// subscription class that exposes buildSubscriptionParams | ||
export class BuildSubscription extends Web3Subscription< | ||
{ data: string }, | ||
{ param1: string }, | ||
{ eth_subscribe: (newHeads: string) => void } | ||
> { | ||
public buildSubscriptionParams() { | ||
this._buildSubscriptionParams(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed, This conditional can never happen as we check
jsonRpc.isResponseWithError(response)
andjsonRpc.isResponseWithResult(response)
seperately