Skip to content

Commit a41049c

Browse files
committed
Allow it in requireAtLeast, require at least 1.26.0 in new test
1 parent d60e5b1 commit a41049c

File tree

5 files changed

+12
-38
lines changed

5 files changed

+12
-38
lines changed

src/collections/config/integration.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ describe('Testing of the collection.config namespace', () => {
239239
expect(config.vectorizers.default.vectorizer.name).toEqual('none');
240240
});
241241

242-
it('should be able to get the config of a collection with hnsw-sq', async () => {
242+
requireAtLeast(1, 26, 0)(it)('should be able to get the config of a collection with hnsw-sq', async () => {
243243
const collectionName = 'TestCollectionConfigGetHNSWPlusSQ';
244244
const collection = await client.collections.create({
245245
name: collectionName,
@@ -418,11 +418,7 @@ describe('Testing of the collection.config namespace', () => {
418418
]);
419419
});
420420

421-
requireAtLeast(
422-
1,
423-
31,
424-
0
425-
)('Mutable named vectors', () => {
421+
requireAtLeast(1, 31, 0)(describe)('Mutable named vectors', () => {
426422
it('should be able to add named vectors to a collection', async () => {
427423
const collectionName = 'TestCollectionConfigAddVector' as const;
428424
const collection = await client.collections.create({

src/collections/query/integration.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,7 @@ describe('Testing of the collection.query methods with a simple collection', ()
134134
expect(ret.objects[0].uuid).toEqual(id);
135135
});
136136

137-
requireAtLeast(
138-
1,
139-
31,
140-
0
141-
)('bm25 search operator (minimum_should_match)', () => {
137+
requireAtLeast(1, 31, 0)(describe)('bm25 search operator (minimum_should_match)', () => {
142138
it('should query with bm25 + operator', async () => {
143139
const ret = await collection.query.bm25('carrot', {
144140
limit: 1,

src/roles/integration.test.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,7 @@ const testCases: TestCase[] = [
279279
},
280280
];
281281

282-
requireAtLeast(
283-
1,
284-
29,
285-
0
286-
)('Integration testing of the roles namespace', () => {
282+
requireAtLeast(1, 29, 0)(describe)('Integration testing of the roles namespace', () => {
287283
let client: WeaviateClient;
288284

289285
beforeAll(async () => {
@@ -317,11 +313,7 @@ requireAtLeast(
317313
expect(exists).toBeFalsy();
318314
});
319315

320-
requireAtLeast(
321-
1,
322-
30,
323-
0
324-
)('namespaced users', () => {
316+
requireAtLeast(1, 30, 0)(describe)('namespaced users', () => {
325317
it('retrieves assigned users with/without namespace', async () => {
326318
await client.roles.create('landlord', {
327319
collection: 'Buildings',

src/users/integration.test.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import { requireAtLeast } from '../../test/version.js';
33
import { WeaviateUserTypeDB } from '../openapi/types.js';
44
import { GetUserOptions, UserDB } from './types.js';
55

6-
requireAtLeast(
7-
1,
8-
29,
9-
0
10-
)('Integration testing of the users namespace', () => {
6+
requireAtLeast(1, 29, 0)(describe)('Integration testing of the users namespace', () => {
117
const makeClient = (key: string) =>
128
weaviate.connectToLocal({
139
port: 8091,
@@ -62,11 +58,7 @@ requireAtLeast(
6258
expect(roles.test).toBeUndefined();
6359
});
6460

65-
requireAtLeast(
66-
1,
67-
30,
68-
0
69-
)('dynamic user management', () => {
61+
requireAtLeast(1, 30, 0)(describe)('dynamic user management', () => {
7062
/** List dynamic DB users. */
7163
const listDBUsers = (c: WeaviateClient, opts?: GetUserOptions) =>
7264
c.users.db.listAll(opts).then((all) => all.filter((u) => u.userType == 'db_user'));
@@ -172,11 +164,7 @@ requireAtLeast(
172164
expect(roles.Permissioner.nodesPermissions).toHaveLength(1);
173165
});
174166

175-
requireAtLeast(
176-
1,
177-
30,
178-
1
179-
)('additional DUM features', () => {
167+
requireAtLeast(1, 30, 1)(describe)('additional DUM features', () => {
180168
it('should be able to fetch additional user info', async () => {
181169
const admin = await makeClient('admin-key');
182170
const timKey = await admin.users.db.create('timely-tim');

test/version.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ import { DbVersion } from '../src/utils/dbVersion';
33
const version = DbVersion.fromString(`v${process.env.WEAVIATE_VERSION!}`);
44

55
/** Run the suite / test only for Weaviate version above this. */
6-
export const requireAtLeast = (...semver: [...Parameters<DbVersion['isAtLeast']>]) =>
7-
version.isAtLeast(...semver) ? describe : describe.skip;
6+
export const requireAtLeast =
7+
(...semver: [...Parameters<DbVersion['isAtLeast']>]) =>
8+
(func: jest.Describe | jest.It) =>
9+
version.isAtLeast(...semver) ? func : func.skip;

0 commit comments

Comments
 (0)