Skip to content

Commit

Permalink
Comment out missed image tests that are no longer tested
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmith023 committed Jan 29, 2025
1 parent a14e2f6 commit 16a033e
Showing 1 changed file with 49 additions and 49 deletions.
98 changes: 49 additions & 49 deletions test/images.journey.test.ts
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);
// });
// });

0 comments on commit 16a033e

Please sign in to comment.