Skip to content

Rework integration tests #303

Description

@Pasu4

Integration tests are currently very behind the state of the extension (using old action names and deprecated handler functions). Also they're kind of messy as all actions of a category are in the same file (which also doesn't respect the recent category split of read/write file actions). The rework would rearrange the tests like so:

suite
+-- actions
    +-- edit_files
    |   +-- insert_text.test.ts
    |   +-- insert_lines.test.ts
    |   +-- ...
    +-- read_files
    |   +-- ...
    +-- ...

That should make it easier to manage tests.
There also should be a better system for simulating an action or parts of its lifecycle, since currently it still relies on the deprecated handler functions from before the standard schema implementation.

Suggestion for helper functions
type ActionSimulationResult = {
    failurePoint: 'none';
} | {
    failurePoint: 'validator';
    validationResult: ActionValidationResult;
} | {
    failurePoint: 'handler';
    handlerResult: ActionHandlerResult;
} | {
    failurePoint: 'cancelEvent';
    cancelEvent: RCECancelEvent;
};

// Simulate an action as if Neuro executed it in Autopilot mode
async function simulateAction<TParams extends ActionData['params']>(
    action: RCEAction<unknown, SchemaTypes, TParams>,
    params: TParams,
    timeout: number,
): ActionSimulationResult;

// Validate the action using sync and async validators
async function simulateActionValidators<TParams extends ActionData['params']>(
    action: RCEAction<unknown, SchemaTypes, TParams>,
    params: TParams,
    timeout: number,
): ActionSimulationResult;

// Simulate an action as if Neuro executed it in Autopilot mode, skipping over validation
async function simulateActionExecution<TParams extends ActionData['params']>(
    action: RCEAction<unknown, SchemaTypes, TParams>,
    params: TParams,
    timeout: number,
): ActionSimulationResult;

// Only register cancellation events and wait
async function simulateActionCancellation<TParams extends ActionData['params']>(
    action: RCEAction<unknown, SchemaTypes, TParams>,
    params: TParams,
    timeout: number,
): ActionSimulationResult;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions