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

feat(W-17669110): add list method to AgentTester #35

Merged
merged 2 commits into from
Jan 24, 2025
Merged
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
12 changes: 11 additions & 1 deletion src/agentTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { Connection, Lifecycle, PollingClient, StatusResult } from '@salesforce/core';
import { Duration, env } from '@salesforce/kit';
import ansis from 'ansis';
import { FileProperties } from '@salesforce/source-deploy-retrieve';
import { MaybeMock } from './maybe-mock';

export type TestStatus = 'New' | 'InProgress' | 'Completed' | 'Error';
Expand Down Expand Up @@ -64,15 +65,24 @@ export type AgentTestResultsResponse = {
};
};

export type AvailableDefinition = Omit<FileProperties, 'manageableState' | 'namespacePrefix'>;

/**
* AgentTester class to test Agents
*/
export class AgentTester {
private maybeMock: MaybeMock;
public constructor(connection: Connection) {
public constructor(private connection: Connection) {
this.maybeMock = new MaybeMock(connection);
}

/**
* List the AiEvaluationDefinitions available in the org.
*/
public async list(): Promise<AvailableDefinition[]> {
return this.connection.metadata.list({ type: 'AiEvaluationDefinition' });
}

/**
* Starts an AI evaluation run based on the provided name or ID.
*
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export { Agent, AgentCreateLifecycleStages, AgentCreateLifecycleStagesV2 } from
export {
AgentTester,
convertTestResultsToFormat,
type AvailableDefinition,
type AgentTestResultsResponse,
type AgentTestStartResponse,
type AgentTestStatusResponse,
Expand Down
Loading