Skip to content

Commit

Permalink
type returns of helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
szwarckonrad committed Apr 21, 2023
1 parent 62fa777 commit 391ed8c
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const API_ENDPOINT_ACTION_PATH = '/api/endpoint/action/*';
export const interceptActionRequests = (
cb: (responseBody: ActionDetails) => void,
alias: string
) => {
): void => {
cy.intercept('POST', API_ENDPOINT_ACTION_PATH, (req) => {
req.continue((res) => {
const {
Expand All @@ -23,36 +23,36 @@ export const interceptActionRequests = (
}).as(alias);
};

export const sendActionResponse = (action: ActionDetails) => {
export const sendActionResponse = (action: ActionDetails): void => {
cy.task('sendHostActionResponse', {
action,
state: { state: 'success' },
});
};

export const isolateHostWithComment = (comment: string, hostname: string) => {
export const isolateHostWithComment = (comment: string, hostname: string): void => {
cy.getByTestSubj('isolate-host-action-item').click();
cy.contains(`Isolate host ${hostname} from network.`);
cy.getByTestSubj('endpointHostIsolationForm');
cy.getByTestSubj('host_isolation_comment').type(comment);
};

export const releaseHostWithComment = (comment: string, hostname: string) => {
export const releaseHostWithComment = (comment: string, hostname: string): void => {
cy.contains(`${hostname} is currently isolated.`);
cy.getByTestSubj('endpointHostIsolationForm');
cy.getByTestSubj('host_isolation_comment').type(comment);
};

export const openAlertDetails = () => {
export const openAlertDetails = (): void => {
cy.getByTestSubj('expand-event').first().click();
cy.getByTestSubj('take-action-dropdown-btn').click();
};

export const openCaseAlertDetails = (alertId: string) => {
export const openCaseAlertDetails = (alertId: string): void => {
cy.getByTestSubj(`comment-action-show-alert-${alertId}`).click();
cy.getByTestSubj('take-action-dropdown-btn').click();
};
export const waitForReleaseOption = (alertId: string) => {
export const waitForReleaseOption = (alertId: string): void => {
openCaseAlertDetails(alertId);
cy.getByTestSubj('event-field-agent.status').then(($status) => {
if ($status.find('[title="Isolated"]').length > 0) {
Expand Down

0 comments on commit 391ed8c

Please sign in to comment.