-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Comment out missed image tests that are no longer tested
- Loading branch information
Showing
1 changed file
with
49 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
import fs from 'fs'; | ||
import weaviate, { toBase64FromMedia } from '../src/'; | ||
// import fs from 'fs'; | ||
// import weaviate, { toBase64FromMedia } from '../src/'; | ||
|
||
describe('Journey testing of the image functionality', () => { | ||
const collectionName = 'ImageJourneyTesting'; | ||
// describe('Journey testing of the image functionality', () => { | ||
// const collectionName = 'ImageJourneyTesting'; | ||
|
||
beforeAll(async () => { | ||
const client = await weaviate.connectToLocal(); | ||
await client.collections.delete(collectionName); | ||
}); | ||
// beforeAll(async () => { | ||
// const client = await weaviate.connectToLocal(); | ||
// await client.collections.delete(collectionName); | ||
// }); | ||
|
||
it('should create a collection with an image property and capable vectorizer', async () => { | ||
const client = await weaviate.connectToLocal(); | ||
await client.collections.create({ | ||
name: collectionName, | ||
properties: [ | ||
{ | ||
name: 'image', | ||
dataType: 'blob', | ||
}, | ||
], | ||
vectorizers: weaviate.configure.vectorizer.img2VecNeural({ | ||
imageFields: ['image'], | ||
}), | ||
}); | ||
}); | ||
// it('should create a collection with an image property and capable vectorizer', async () => { | ||
// const client = await weaviate.connectToLocal(); | ||
// await client.collections.create({ | ||
// name: collectionName, | ||
// properties: [ | ||
// { | ||
// name: 'image', | ||
// dataType: 'blob', | ||
// }, | ||
// ], | ||
// vectorizers: weaviate.configure.vectorizer.img2VecNeural({ | ||
// imageFields: ['image'], | ||
// }), | ||
// }); | ||
// }); | ||
|
||
it('should insert an encoded image', async () => { | ||
const client = await weaviate.connectToLocal(); | ||
await client.collections.get(collectionName).data.insert({ | ||
image: await toBase64FromMedia('./public/favicon.ico'), | ||
}); | ||
}); | ||
// it('should insert an encoded image', async () => { | ||
// const client = await weaviate.connectToLocal(); | ||
// await client.collections.get(collectionName).data.insert({ | ||
// image: await toBase64FromMedia('./public/favicon.ico'), | ||
// }); | ||
// }); | ||
|
||
it('should retrieve the encoded image', async () => { | ||
const client = await weaviate.connectToLocal(); | ||
const res = await client.collections | ||
.get(collectionName) | ||
.query.fetchObjects({ returnProperties: ['image'] }); | ||
expect(res.objects[0].properties.image).toBeDefined(); | ||
}); | ||
// it('should retrieve the encoded image', async () => { | ||
// const client = await weaviate.connectToLocal(); | ||
// const res = await client.collections | ||
// .get(collectionName) | ||
// .query.fetchObjects({ returnProperties: ['image'] }); | ||
// expect(res.objects[0].properties.image).toBeDefined(); | ||
// }); | ||
|
||
it('should search on the encoded image vector with a file path string', async () => { | ||
const client = await weaviate.connectToLocal(); | ||
const res = await client.collections.get(collectionName).query.nearImage('./public/favicon.ico'); | ||
expect(res.objects.length).toEqual(1); | ||
}); | ||
// it('should search on the encoded image vector with a file path string', async () => { | ||
// const client = await weaviate.connectToLocal(); | ||
// const res = await client.collections.get(collectionName).query.nearImage('./public/favicon.ico'); | ||
// expect(res.objects.length).toEqual(1); | ||
// }); | ||
|
||
it('should search on the encoded image vector with a buffer', async () => { | ||
const client = await weaviate.connectToLocal(); | ||
const res = await client.collections | ||
.get(collectionName) | ||
.query.nearImage(fs.readFileSync('./public/favicon.ico')); // eslint-disable-line no-sync | ||
expect(res.objects.length).toEqual(1); | ||
}); | ||
}); | ||
// it('should search on the encoded image vector with a buffer', async () => { | ||
// const client = await weaviate.connectToLocal(); | ||
// const res = await client.collections | ||
// .get(collectionName) | ||
// .query.nearImage(fs.readFileSync('./public/favicon.ico')); // eslint-disable-line no-sync | ||
// expect(res.objects.length).toEqual(1); | ||
// }); | ||
// }); |