|
1 | 1 | import weaviate from '../index.js'; |
2 | | -import { connectToWeaviateCloud } from './helpers.js'; |
3 | 2 |
|
4 | 3 | const WCD_URL = 'https://piblpmmdsiknacjnm1ltla.c1.europe-west3.gcp.weaviate.cloud'; |
5 | 4 | const WCD_KEY = 'cy4ua772mBlMdfw3YnclqAWzFhQt0RLIN0sl'; |
@@ -30,57 +29,4 @@ describe('Testing of the connection helper methods', () => { |
30 | 29 | throw new Error('it should not have errord: ' + e); |
31 | 30 | }); |
32 | 31 | }); |
33 | | - |
34 | | - describe('adds Weaviate Embedding Service headers', () => { |
35 | | - it('to empty headers', async () => { |
36 | | - const clientMakerMock = jest.fn().mockResolvedValue(undefined); |
37 | | - |
38 | | - await connectToWeaviateCloud(WCD_URL, clientMakerMock, { |
39 | | - authCredentials: new weaviate.ApiKey(WCD_KEY), |
40 | | - }); |
41 | | - |
42 | | - expect(clientMakerMock.mock.calls[0][0].headers).toEqual({ |
43 | | - 'X-Weaviate-Api-Key': WCD_KEY, |
44 | | - 'X-Weaviate-Cluster-Url': WCD_URL, |
45 | | - }); |
46 | | - }); |
47 | | - |
48 | | - it('to existing headers', async () => { |
49 | | - const clientMakerMock = jest.fn().mockResolvedValue(undefined); |
50 | | - |
51 | | - await connectToWeaviateCloud(WCD_URL, clientMakerMock, { |
52 | | - authCredentials: new weaviate.ApiKey(WCD_KEY), |
53 | | - headers: { existingHeader: 'existingValue' }, |
54 | | - }); |
55 | | - |
56 | | - expect(clientMakerMock.mock.calls[0][0].headers).toEqual({ |
57 | | - existingHeader: 'existingValue', |
58 | | - 'X-Weaviate-Api-Key': WCD_KEY, |
59 | | - 'X-Weaviate-Cluster-Url': WCD_URL, |
60 | | - }); |
61 | | - }); |
62 | | - }); |
63 | | - |
64 | | - describe('does not add Weaviate Embedding Service headers when not using API key', () => { |
65 | | - it('to empty headers', async () => { |
66 | | - const clientMakerMock = jest.fn().mockResolvedValue(undefined); |
67 | | - |
68 | | - await connectToWeaviateCloud(WCD_URL, clientMakerMock, { |
69 | | - authCredentials: new weaviate.AuthUserPasswordCredentials({ username: 'test' }), |
70 | | - }); |
71 | | - |
72 | | - expect(clientMakerMock.mock.calls[0][0].headers).toBe(undefined); |
73 | | - }); |
74 | | - |
75 | | - it('to existing headers', async () => { |
76 | | - const clientMakerMock = jest.fn().mockResolvedValue(undefined); |
77 | | - |
78 | | - await connectToWeaviateCloud(WCD_URL, clientMakerMock, { |
79 | | - authCredentials: new weaviate.AuthUserPasswordCredentials({ username: 'test' }), |
80 | | - headers: { existingHeader: 'existingValue' }, |
81 | | - }); |
82 | | - |
83 | | - expect(clientMakerMock.mock.calls[0][0].headers).toEqual({ existingHeader: 'existingValue' }); |
84 | | - }); |
85 | | - }); |
86 | 32 | }); |
0 commit comments