mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-07 00:15:23 +02:00
fix: fixed ESLint errors in GraphApiService
This commit is contained in:
parent
d921cdb3af
commit
41a4a601bf
2 changed files with 6 additions and 7 deletions
|
|
@ -88,7 +88,7 @@ const exchangeTokenForGraphAccess = async (config, accessToken, sub) => {
|
|||
if (process.env.PROXY && process.env.PROXY.trim()) {
|
||||
const httpsAgent = new HttpsProxyAgent(process.env.PROXY);
|
||||
clientOptions[Symbol.for('openid-client.custom.fetch')] = (url, options = {}) => {
|
||||
return nodeFetch(url, { ...options, agent: httpsAgent });
|
||||
return nodeFetch(url, { ...options, agent: httpsAgent });
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -807,7 +807,6 @@ describe('GraphApiService', () => {
|
|||
describe('Proxy Configuration', () => {
|
||||
let originalEnv;
|
||||
const { ProxyAgent } = require('undici');
|
||||
const { HttpsProxyAgent } = require('https-proxy-agent');
|
||||
|
||||
beforeAll(() => {
|
||||
originalEnv = { ...process.env };
|
||||
|
|
@ -845,7 +844,7 @@ describe('GraphApiService', () => {
|
|||
|
||||
expect(Client.init).toHaveBeenCalled();
|
||||
const initCall = Client.init.mock.calls[0][0];
|
||||
|
||||
|
||||
// fetchOptions should either not exist or not have a dispatcher
|
||||
if (initCall.fetchOptions) {
|
||||
expect(initCall.fetchOptions.dispatcher).toBeUndefined();
|
||||
|
|
@ -880,7 +879,7 @@ describe('GraphApiService', () => {
|
|||
if (client.genericGrantRequest) {
|
||||
expect(client.genericGrantRequest).toHaveBeenCalled();
|
||||
const clientOptions = client.genericGrantRequest.mock.calls[0][3];
|
||||
|
||||
|
||||
expect(clientOptions).toBeDefined();
|
||||
const customFetchSymbol = Symbol.for('openid-client.custom.fetch');
|
||||
expect(clientOptions[customFetchSymbol]).toBeDefined();
|
||||
|
|
@ -901,7 +900,7 @@ describe('GraphApiService', () => {
|
|||
if (client.genericGrantRequest) {
|
||||
expect(client.genericGrantRequest).toHaveBeenCalled();
|
||||
const clientOptions = client.genericGrantRequest.mock.calls[0][3];
|
||||
|
||||
|
||||
// clientOptions should be empty object or not have custom fetch
|
||||
expect(clientOptions).toEqual({});
|
||||
}
|
||||
|
|
@ -921,7 +920,7 @@ describe('GraphApiService', () => {
|
|||
if (client.genericGrantRequest) {
|
||||
const clientOptions = client.genericGrantRequest.mock.calls[0][3];
|
||||
const customFetch = clientOptions[Symbol.for('openid-client.custom.fetch')];
|
||||
|
||||
|
||||
expect(customFetch).toBeDefined();
|
||||
expect(typeof customFetch).toBe('function');
|
||||
}
|
||||
|
|
@ -940,7 +939,7 @@ describe('GraphApiService', () => {
|
|||
if (client.genericGrantRequest) {
|
||||
const clientOptions = client.genericGrantRequest.mock.calls[0][3];
|
||||
const customFetch = clientOptions[Symbol.for('openid-client.custom.fetch')];
|
||||
|
||||
|
||||
// Test that custom fetch function is created with HttpsProxyAgent
|
||||
expect(customFetch).toBeDefined();
|
||||
expect(typeof customFetch).toBe('function');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue