|
1 | 1 | /* eslint-disable @typescript-eslint/no-non-null-assertion */ |
| 2 | +import { requireAtLeast } from '../../../test/version.js'; |
2 | 3 | import { WeaviateUnsupportedFeatureError } from '../../errors.js'; |
3 | 4 | import weaviate, { WeaviateClient, weaviateV2 } from '../../index.js'; |
4 | 5 | import { |
@@ -386,25 +387,27 @@ describe('Testing of the collection.config namespace', () => { |
386 | 387 | ]); |
387 | 388 | }); |
388 | 389 |
|
389 | | - it('should be able to add a reference to a collection', async () => { |
390 | | - const collectionName = 'TestCollectionConfigAddVector' as const; |
391 | | - const collection = await client.collections.create({ |
392 | | - name: collectionName, |
393 | | - vectorizers: [weaviate.configure.vectorizer.none({ name: 'original' })], |
| 390 | + requireAtLeast(1, 31, 0)('Mutable named vectors', () => { |
| 391 | + it('should be able to add named vectors to a collection', async () => { |
| 392 | + const collectionName = 'TestCollectionConfigAddVector' as const; |
| 393 | + const collection = await client.collections.create({ |
| 394 | + name: collectionName, |
| 395 | + vectorizers: [weaviate.configure.vectorizer.none({ name: 'original' })], |
| 396 | + }); |
| 397 | + // Add a single named vector |
| 398 | + await collection.config.addVector(weaviate.configure.vectorizer.none({ name: 'vector-a' })); |
| 399 | + |
| 400 | + // Add several named vectors |
| 401 | + await collection.config.addVector([ |
| 402 | + weaviate.configure.vectorizer.none({ name: 'vector-b' }), |
| 403 | + weaviate.configure.vectorizer.none({ name: 'vector-c' }), |
| 404 | + ]); |
| 405 | + |
| 406 | + const config = await collection.config.get(); |
| 407 | + expect(config.vectorizers).toHaveProperty('vector-a'); |
| 408 | + expect(config.vectorizers).toHaveProperty('vector-b'); |
| 409 | + expect(config.vectorizers).toHaveProperty('vector-c'); |
394 | 410 | }); |
395 | | - // Add a single named vector |
396 | | - await collection.config.addVector(weaviate.configure.vectorizer.none({ name: 'vector-a' })); |
397 | | - |
398 | | - // Add several named vectors |
399 | | - await collection.config.addVector([ |
400 | | - weaviate.configure.vectorizer.none({ name: 'vector-b' }), |
401 | | - weaviate.configure.vectorizer.none({ name: 'vector-c' }), |
402 | | - ]); |
403 | | - |
404 | | - const config = await collection.config.get(); |
405 | | - expect(config.vectorizers).toHaveProperty('vector-a'); |
406 | | - expect(config.vectorizers).toHaveProperty('vector-b'); |
407 | | - expect(config.vectorizers).toHaveProperty('vector-c'); |
408 | 411 | }); |
409 | 412 |
|
410 | 413 | it('should get the shards of a sharded collection', async () => { |
|
0 commit comments