Skip to content

Commit

Permalink
Build out index tags tests a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
aulorbe committed Dec 23, 2024
1 parent 4516c53 commit f2b54c1
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/integration/control/configureIndex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,52 @@ describe('configure index', () => {
});
});

test('Add index tag to a serverless index', async () => {
const description = await pinecone.describeIndex(serverlessIndexName);
expect(description.tags).toEqual({
project: 'pinecone-integration-tests',
});

await pinecone.configureIndex(serverlessIndexName, {
tags: { testTag: 'testValue' },
});
const description2 = await pinecone.describeIndex(serverlessIndexName);
expect(description2.tags).toEqual({
project: 'pinecone-integration-tests',
testTag: 'testValue',
});
});

test('Remove index tag from serverless index', async () => {
const description = await pinecone.describeIndex(serverlessIndexName);
expect(description.tags).toEqual({
project: 'pinecone-integration-tests',
testTag: 'testValue',
});

await pinecone.configureIndex(serverlessIndexName, {
tags: { project: '' },
});
const description2 = await pinecone.describeIndex(serverlessIndexName);
expect(description2.tags).toBeUndefined();
if (description2.tags != null) {
expect(description2.tags['project']).toBeUndefined();
expect(description2.tags['testTag']).toEqual('testValue');
}
});

test('Update a tag value in a serverless index', async () => {
const description = await pinecone.describeIndex(serverlessIndexName);
expect(description.tags).toEqual({
testTag: 'testValue',
});

await pinecone.configureIndex(serverlessIndexName, {
tags: { testTag: 'newValue' },
});
const description2 = await pinecone.describeIndex(serverlessIndexName);
if (description2.tags != null) {
expect(description2.tags['testTag']).toEqual('newValue');
}
});
});

Expand Down

0 comments on commit f2b54c1

Please sign in to comment.