Skip to content

Commit 2a22e92

Browse files
committed
Fix highly coupled tests with old Weaviate vers
1 parent 71a98ae commit 2a22e92

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/schema/journey.test.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ describe('schema', () => {
6262
return client.schema.exists('NonExistingClass').then((res) => expect(res).toEqual(false));
6363
});
6464

65-
it('extends the thing class with a new property', () => {
65+
it('extends the thing class with a new property', async () => {
6666
const className = 'MyThingClass';
6767
const prop: Property = {
6868
dataType: ['text'],
6969
name: 'anotherProp',
7070
tokenization: 'field',
7171
indexFilterable: true,
72-
indexRangeable: false,
72+
indexRangeable: (await isVer(client, 26, 0)) ? false : undefined,
7373
indexSearchable: true,
7474
moduleConfig: {
7575
'text2vec-contextionary': {
@@ -537,9 +537,12 @@ describe('property setting defaults and migrations', () => {
537537
}
538538
);
539539

540-
const errMsg1 =
541-
'`indexInverted` is deprecated and can not be set together with `indexFilterable`, `indexSearchable` or `indexRangeable`';
542-
const errMsg2 = '`indexSearchable`';
540+
const errMsg1 = isVer(client, 26, 0).then((yes) =>
541+
yes
542+
? '`indexInverted` is deprecated and can not be set together with `indexFilterable`, `indexSearchable` or `indexRangeable`'
543+
: '`indexInverted` is deprecated and can not be set together with `indexFilterable` or `indexSearchable`'
544+
);
545+
const errMsg2 = Promise.resolve('`indexSearchable`');
543546
test.each([
544547
['text', false, null, false, errMsg1],
545548
['text', false, null, true, errMsg1],
@@ -585,7 +588,7 @@ describe('property setting defaults and migrations', () => {
585588
inverted: boolean | null,
586589
filterable: boolean | null,
587590
searchable: boolean | null,
588-
errMsg: string
591+
errMsg: Promise<string>
589592
) => {
590593
await client.schema
591594
.classCreator()
@@ -602,8 +605,8 @@ describe('property setting defaults and migrations', () => {
602605
],
603606
})
604607
.do()
605-
.catch((e: Error) => {
606-
expect(e.message).toContain(errMsg);
608+
.catch(async (e: Error) => {
609+
expect(e.message).toContain(await errMsg);
607610
});
608611
}
609612
);
@@ -759,7 +762,7 @@ async function newClassObject(
759762
name: 'stringProp',
760763
tokenization: 'word',
761764
indexFilterable: true,
762-
indexRangeable: false,
765+
indexRangeable: (await is1260Promise) ? false : undefined,
763766
indexSearchable: true,
764767
moduleConfig: {
765768
'text2vec-contextionary': {
@@ -793,11 +796,13 @@ async function newClassObject(
793796
bq: {
794797
enabled: false,
795798
},
796-
sq: {
797-
enabled: false,
798-
rescoreLimit: 20,
799-
trainingLimit: 100000,
800-
},
799+
sq: (await is1260Promise)
800+
? {
801+
enabled: false,
802+
rescoreLimit: 20,
803+
trainingLimit: 100000,
804+
}
805+
: undefined,
801806
skip: false,
802807
efConstruction: 128,
803808
vectorCacheMaxObjects: 500000,

0 commit comments

Comments
 (0)