Skip to content

Commit

Permalink
lint e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
carneiro-cw committed Dec 20, 2024
1 parent 0b25e87 commit 2b658ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions e2e/test/admin/e2e-admin-password-disabled.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect } from "chai";

import { send, sendReset } from "../helpers/rpc";

describe("Admin Password (without password set)", () => {
Expand Down
1 change: 1 addition & 0 deletions e2e/test/admin/e2e-admin-password-enabled.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect } from "chai";

import { send, sendAndGetError, sendReset } from "../helpers/rpc";

describe("Admin Password (with password set)", () => {
Expand Down
14 changes: 11 additions & 3 deletions e2e/test/helpers/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ if (process.env.RPC_LOG) {
// Sends an RPC request to the blockchain, returning full response.
let requestId = 0;

export async function sendAndGetFullResponse(method: string, params: any[] = [], headers: Record<string, string> = {}): Promise<any> {
export async function sendAndGetFullResponse(
method: string,
params: any[] = [],
headers: Record<string, string> = {},
): Promise<any> {
for (let i = 0; i < params.length; ++i) {
const param = params[i];
if (param instanceof Account) {
Expand All @@ -133,7 +137,7 @@ export async function sendAndGetFullResponse(method: string, params: any[] = [],
// prepare headers
const requestHeaders = {
"Content-Type": "application/json",
...headers
...headers,
};

// execute request and log response
Expand All @@ -153,7 +157,11 @@ export async function send(method: string, params: any[] = [], headers: Record<s

// Sends an RPC request to the blockchain, returning its error field.
// Use it when you expect the RPC call to fail.
export async function sendAndGetError(method: string, params: any[] = [], headers: Record<string, string> = {}): Promise<any> {
export async function sendAndGetError(
method: string,
params: any[] = [],
headers: Record<string, string> = {},
): Promise<any> {
const response = await sendAndGetFullResponse(method, params, headers);
return response.data.error;
}
Expand Down

0 comments on commit 2b658ff

Please sign in to comment.