UNPKG

@pinecone-database/pinecone

Version:

This is the official Node.js SDK for [Pinecone](https://www.pinecone.io), written in TypeScript.

30 lines 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const describeBackup_1 = require("../describeBackup"); const errors_1 = require("../../errors"); describe('describeBackup', () => { const setupSuccessResponse = (responseData) => { const fakeDescribeBackup = jest .fn() .mockImplementation(() => Promise.resolve(responseData)); const MIA = { describeBackup: fakeDescribeBackup, }; return MIA; }; test('calls the openapi describe backup endpoint, passing backupId', async () => { const MIA = setupSuccessResponse(undefined); const returned = await (0, describeBackup_1.describeBackup)(MIA)('backup-id'); expect(returned).toEqual(undefined); expect(MIA.describeBackup).toHaveBeenCalledWith({ backupId: 'backup-id', }); }); test('should throw backupId is not provided', async () => { const MIA = setupSuccessResponse(''); // @ts-ignore await expect((0, describeBackup_1.describeBackup)(MIA)()).rejects.toThrow('You must pass a non-empty string for `backupId` in order to describe a backup'); await expect((0, describeBackup_1.describeBackup)(MIA)('')).rejects.toThrow(errors_1.PineconeArgumentError); }); }); //# sourceMappingURL=describeBackup.test.js.map