@pinecone-database/pinecone
Version:
This is the official Node.js SDK for [Pinecone](https://www.pinecone.io), written in TypeScript.
37 lines • 1.48 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const listBackups_1 = require("../listBackups");
describe('listBackups', () => {
const setupSuccessResponse = (responseData = {}) => {
const fakeListIndexBackups = jest
.fn()
.mockImplementation(() => Promise.resolve(responseData));
const fakeListProjectBackups = jest
.fn()
.mockImplementation(() => Promise.resolve(responseData));
const MIA = {
listIndexBackups: fakeListIndexBackups,
listProjectBackups: fakeListProjectBackups,
};
return MIA;
};
test('calls the openapi describe index backup endpoint when indexName provided', async () => {
const MIA = setupSuccessResponse();
await (0, listBackups_1.listBackups)(MIA)({
indexName: 'my-index',
limit: 10,
paginationToken: 'pagination-token',
});
expect(MIA.listIndexBackups).toHaveBeenCalledWith({
indexName: 'my-index',
limit: 10,
paginationToken: 'pagination-token',
});
});
test('calls the openapi describe project backup endpoint when indexName is not provided', async () => {
const MIA = setupSuccessResponse(undefined);
await (0, listBackups_1.listBackups)(MIA)();
expect(MIA.listProjectBackups).toHaveBeenCalled();
});
});
//# sourceMappingURL=listBackups.test.js.map
;