Skip to content

Commit 70ac607

Browse files
committed
Add tests
Signed-off-by: Luis Mastrangelo <[email protected]>
1 parent b9437ef commit 70ac607

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

packages/relay/tests/lib/debug.spec.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ let restMock: MockAdapter;
3434
let web3Mock: MockAdapter;
3535
let mirrorNodeInstance: MirrorNodeClient;
3636
let debugService: DebugImpl;
37-
let hapiServiceInstance: HAPIService;
3837

3938
describe('Debug API Test Suite', async function () {
4039
this.timeout(10000);
@@ -61,7 +60,6 @@ describe('Debug API Test Suite', async function () {
6160
const CONTRACT_BY_ADDRESS2 = `contracts/${contractAddress2}`;
6261
const CONTRACTS_RESULTS_BY_NON_EXISTENT_HASH = `contracts/results/${nonExistentTransactionHash}`;
6362
const CONTRACT_RESULTS_BY_ACTIONS_NON_EXISTENT_HASH = `contracts/results/${nonExistentTransactionHash}/actions`;
64-
const BLOCKS_ENDPOINT = 'blocks';
6563

6664
const opcodeLoggerConfigs = [
6765
{
@@ -276,7 +274,7 @@ describe('Debug API Test Suite', async function () {
276274
register,
277275
duration,
278276
);
279-
hapiServiceInstance = new HAPIService(logger, registry, eventEmitter, hbarLimitService);
277+
new HAPIService(logger, registry, eventEmitter, hbarLimitService);
280278

281279
restMock = new MockAdapter(mirrorNodeInstance.getMirrorNodeRestInstance(), { onNoMatch: 'throwException' });
282280

@@ -439,6 +437,30 @@ describe('Debug API Test Suite', async function () {
439437
});
440438

441439
describe('opcodeLogger', async function () {
440+
withOverriddenEnvsInMochaTest({ OPCODE_LOGGER_ENABLED: undefined }, () => {
441+
it('should throw UNSUPPORTED_METHOD', async function () {
442+
await RelayAssertions.assertRejection(
443+
predefined.UNSUPPORTED_METHOD,
444+
debugService.traceTransaction,
445+
true,
446+
debugService,
447+
[transactionHash, callTracer, tracerConfigFalse, requestDetails],
448+
);
449+
});
450+
});
451+
452+
withOverriddenEnvsInMochaTest({ OPCODE_LOGGER_ENABLED: false }, () => {
453+
it('should throw UNSUPPORTED_METHOD', async function () {
454+
await RelayAssertions.assertRejection(
455+
predefined.UNSUPPORTED_METHOD,
456+
debugService.traceTransaction,
457+
true,
458+
debugService,
459+
[transactionHash, callTracer, tracerConfigFalse, requestDetails],
460+
);
461+
});
462+
});
463+
442464
for (const config of opcodeLoggerConfigs) {
443465
const opcodeLoggerParams = Object.keys(config)
444466
.map((key) => `${key}=${config[key]}`)

0 commit comments

Comments
 (0)