Skip to content

Commit

Permalink
feat(pipelines): add excludeAbTestTargets parameter to options (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
aboissinot-coveo authored Mar 15, 2024
1 parent 19fa274 commit bdc96cf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/resources/Pipelines/PipelinesInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ export interface ListPipelinesOptions extends Paginated {
* Whether to enable pagination.
*/
enablePagination?: boolean;
/**
* Whether to exclude the A/B test targets from the result.
*/
excludeAbTestTargets?: boolean;
}

export type PaginatedListPipelinesModel = Omit<PageModel<PipelineModel>, 'totalPages'>;
Expand Down
33 changes: 24 additions & 9 deletions src/resources/Pipelines/tests/Pipelines.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,30 @@ describe('Pipelines', () => {
});

describe('list', () => {
it('should make a GET call to the Pipelines v1 url', () => {
it('makes a GET call to the Pipelines v1 url', () => {
pipelines.list();
expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(Pipelines.searchUrlVersion1);
});
it('passes the query parameters with the request', () => {
pipelines.list({
filter: 'filter',
page: 0,
perPage: 25,
sortby: 'position',
isOrderAscending: true,
enablePagination: true,
excludeAbTestTargets: true,
});
expect(api.get).toHaveBeenCalledTimes(1);
expect(api.get).toHaveBeenCalledWith(
`${Pipelines.searchUrlVersion1}?filter=filter&page=0&perPage=25&sortby=position&isOrderAscending=true&enablePagination=true&excludeAbTestTargets=true`,
);
});
});

describe('get', () => {
it('should make a GET call to /rest/search/v1/admin/pipelines/:id', () => {
it('makes a GET call to /rest/search/v1/admin/pipelines/:id', () => {
pipelines.get('🔥');

expect(api.get).toHaveBeenCalledTimes(1);
Expand All @@ -34,7 +49,7 @@ describe('Pipelines', () => {
});

describe('delete', () => {
it('should make a DELETE call to /rest/search/v1/admin/pipelines/:id', () => {
it('makes a DELETE call to /rest/search/v1/admin/pipelines/:id', () => {
pipelines.delete('🔥');

expect(api.delete).toHaveBeenCalledTimes(1);
Expand All @@ -43,7 +58,7 @@ describe('Pipelines', () => {
});

describe('update', () => {
it('should make a PUT call to /rest/search/v1/admin/pipelines/:id', () => {
it('makes a PUT call to /rest/search/v1/admin/pipelines/:id', () => {
const pipelineToUpdate: UpdatePipelineModel = {
id: '🔥',
name: 'fire',
Expand All @@ -56,7 +71,7 @@ describe('Pipelines', () => {
});

describe('duplicate', () => {
it('should make a POST call to /rest/search/v1/admin/pipelines/:id/duplicate', () => {
it('makes a POST call to /rest/search/v1/admin/pipelines/:id/duplicate', () => {
pipelines.duplicate('🔥');

expect(api.post).toHaveBeenCalledTimes(1);
Expand All @@ -76,7 +91,7 @@ describe('Pipelines', () => {
});

describe('create', () => {
it('should make a POST call to /rest/search/v1/admin/pipelines', () => {
it('makes a POST call to /rest/search/v1/admin/pipelines', () => {
const newPipeline: NewPipelineModel = {
name: 'fire',
description: 'this-is-lit',
Expand All @@ -89,15 +104,15 @@ describe('Pipelines', () => {
});

describe('nested resources', () => {
it('should front associations', () => {
it('includes associations', () => {
expect(pipelines.associations).toBeDefined();
});

it('should front statements', () => {
it('includes statements', () => {
expect(pipelines.statements).toBeDefined();
});

it('should front resultRanking', () => {
it('includes resultRanking', () => {
expect(pipelines.resultRanking).toBeDefined();
});
});
Expand Down

0 comments on commit bdc96cf

Please sign in to comment.