Skip to content
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

chore: Clean up some code #12287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ describe('JsTaskRunner', () => {
),
});

// Assert
expect(rpcCallSpy).toHaveBeenCalledWith('1', group.method, group.expectedParams);
});

Expand Down Expand Up @@ -661,26 +662,22 @@ describe('JsTaskRunner', () => {
describe('unsupported methods', () => {
for (const unsupportedFunction of UNSUPPORTED_HELPER_FUNCTIONS) {
it(`should throw an error if ${unsupportedFunction} is used in runOnceForAllItems`, async () => {
// Act

// Act & Assert
await expect(
async () =>
await executeForAllItems({
code: `${unsupportedFunction}()`,
inputItems,
}),
executeForAllItems({
code: `${unsupportedFunction}()`,
inputItems,
}),
).rejects.toThrow(UnsupportedFunctionError);
});

it(`should throw an error if ${unsupportedFunction} is used in runOnceForEachItem`, async () => {
// Act

// Act & Assert
await expect(
async () =>
await executeForEachItem({
code: `${unsupportedFunction}()`,
inputItems,
}),
executeForEachItem({
code: `${unsupportedFunction}()`,
inputItems,
}),
).rejects.toThrow(UnsupportedFunctionError);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import { createRequireResolver } from './require-resolver';
import { validateRunForAllItemsOutput, validateRunForEachItemOutput } from './result-validation';
import { DataRequestResponseReconstruct } from '../data-request/data-request-response-reconstruct';

export interface RPCCallObject {
[name: string]: ((...args: unknown[]) => Promise<unknown>) | RPCCallObject;
export interface RpcCallObject {
[name: string]: ((...args: unknown[]) => Promise<unknown>) | RpcCallObject;
}

export interface JSExecSettings {
Expand Down Expand Up @@ -449,7 +449,7 @@ export class JsTaskRunner extends TaskRunner {
}

private buildRpcCallObject(taskId: string) {
const rpcObject: RPCCallObject = {};
const rpcObject: RpcCallObject = {};

for (const rpcMethod of EXPOSED_RPC_METHODS) {
set(
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/SerializedBuffer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const validSerializedBuffer: SerializedBuffer = {
data: [65, 66, 67], // Corresponds to 'ABC' in ASCII
};

describe('serializedBufferToBuffer', () => {
describe('toBuffer', () => {
it('should convert a SerializedBuffer to a Buffer', () => {
const buffer = toBuffer(validSerializedBuffer);
expect(buffer).toBeInstanceOf(Buffer);
Expand Down Expand Up @@ -43,7 +43,7 @@ describe('isSerializedBuffer', () => {
});
});

describe('Integration: serializedBufferToBuffer and isSerializedBuffer', () => {
describe('Integration: toBuffer and isSerializedBuffer', () => {
it('should correctly validate and convert a SerializedBuffer', () => {
if (isSerializedBuffer(validSerializedBuffer)) {
const buffer = toBuffer(validSerializedBuffer);
Expand Down
Loading