Skip to content

Commit 795a9a2

Browse files
committed
Fix flakey test due to unordered Weaviate returns
1 parent 0e6148f commit 795a9a2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/collections/filters/integration.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,18 @@ describe('Testing of the filter class with a simple collection', () => {
146146
});
147147
expect(res.objects.length).toEqual(2);
148148

149-
const obj1 = res.objects[0];
150-
const obj2 = res.objects[1];
149+
// Return of fetch not necessarily in order due to filter
150+
expect(res.objects.map((o) => o.properties.text)).toContain('two');
151+
expect(res.objects.map((o) => o.properties.text)).toContain('three');
151152

152-
expect(obj1.properties.text).toEqual('two');
153-
expect(obj1.properties.int).toEqual(2);
154-
expect(obj1.properties.float).toEqual(2.2);
155-
expect(obj1.uuid).toEqual(ids[1]);
153+
expect(res.objects.map((o) => o.properties.int)).toContain(2);
154+
expect(res.objects.map((o) => o.properties.int)).toContain(3);
156155

157-
expect(obj2.properties.text).toEqual('three');
158-
expect(obj2.properties.int).toEqual(3);
159-
expect(obj2.properties.float).toEqual(3.3);
160-
expect(obj2.uuid).toEqual(ids[2]);
156+
expect(res.objects.map((o) => o.properties.float)).toContain(2.2);
157+
expect(res.objects.map((o) => o.properties.float)).toContain(3.3);
158+
159+
expect(res.objects.map((o) => o.uuid)).toContain(ids[1]);
160+
expect(res.objects.map((o) => o.uuid)).toContain(ids[2]);
161161
});
162162

163163
it('should filter a fetch objects query with a reference filter', async () => {

0 commit comments

Comments
 (0)