Skip to content

Commit

Permalink
feat(ngsp): /manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart committed Jan 18, 2024
1 parent 9f03074 commit 4723809
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/resources/NextGenSearchPages/NextGenSearchPages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,11 @@ export default class NextGenSearchPages extends Resource {
requestAccess(searchPageId: string): Promise<void> {
return this.api.post<void>(`${NextGenSearchPages.baseUrl}/${searchPageId}/accesses/request`);
}

manifest(
interfaceId: string,
options?: IManifestParameters,
): Promise<IManifestResponse<SearchPageInterfaceConfiguration>> {
return this.api.post(`${NextGenSearchPages.baseUrl}/${interfaceId}/manifest`, options);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import API from '../../../APICore.js';
import {SortingBy} from '../../Enums.js';
import {ExistingHostedInterface, HostedInterfaceConditionOperator} from '../../HostedInterfacesCore/index.js';
import {
ExistingHostedInterface,
HostedInterfaceConditionOperator,
IManifestParameters,
} from '../../HostedInterfacesCore/index.js';
import NextGenSearchPages from '../NextGenSearchPages.js';
import {SearchPageInterfaceConfiguration, SearchPageLayout} from '../NextGenSearchPages.model.js';
jest.mock('../../../APICore.js');
Expand Down Expand Up @@ -323,4 +327,24 @@ describe('NextGenSearchPages', () => {
expect(api.post).toHaveBeenCalledWith(`${NextGenSearchPages.baseUrl}/${id}/accesses/request`);
});
});

describe('manifest', () => {
it('makes a POST call (without a body) to the searchInterfaces accesses manifest url based on the interfaceId', () => {
const id = 'search-interface-id';

nextGenSearchPages.manifest(id);

expect(api.post).toHaveBeenCalledTimes(1);
expect(api.post).toHaveBeenCalledWith(`${NextGenSearchPages.baseUrl}/${id}/manifest`, undefined);
});

it('makes a POST call (with a body) to the searchInterfaces accesses manifest url based on the interfaceId', () => {
const id = 'search-interface-id';
const options: IManifestParameters = {pagePlaceholders: {results: 'myresults'}};
nextGenSearchPages.manifest(id, options);

expect(api.post).toHaveBeenCalledTimes(1);
expect(api.post).toHaveBeenCalledWith(`${NextGenSearchPages.baseUrl}/${id}/manifest`, options);
});
});
});

0 comments on commit 4723809

Please sign in to comment.