mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 08:13:43 +08:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			9b6edcb179
			...
			61923e5c72
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					61923e5c72 | 
@@ -15,8 +15,6 @@ const config: Config = {
 | 
			
		||||
  moduleNameMapper: {
 | 
			
		||||
    "^@/(.*)$": "<rootDir>/$1",
 | 
			
		||||
  },
 | 
			
		||||
  extensionsToTreatAsEsm: [".ts", ".tsx"],
 | 
			
		||||
  injectGlobals: true,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
 | 
			
		||||
 
 | 
			
		||||
@@ -1,22 +1,24 @@
 | 
			
		||||
// Learn more: https://github.com/testing-library/jest-dom
 | 
			
		||||
import "@testing-library/jest-dom";
 | 
			
		||||
import { jest } from "@jest/globals";
 | 
			
		||||
 | 
			
		||||
global.fetch = jest.fn(() =>
 | 
			
		||||
  Promise.resolve({
 | 
			
		||||
    ok: true,
 | 
			
		||||
    status: 200,
 | 
			
		||||
    json: () => Promise.resolve([]),
 | 
			
		||||
    json: () => Promise.resolve({}),
 | 
			
		||||
    headers: new Headers(),
 | 
			
		||||
    redirected: false,
 | 
			
		||||
    statusText: "OK",
 | 
			
		||||
    type: "basic",
 | 
			
		||||
    url: "",
 | 
			
		||||
    clone: function () {
 | 
			
		||||
      return this;
 | 
			
		||||
    },
 | 
			
		||||
    body: null,
 | 
			
		||||
    bodyUsed: false,
 | 
			
		||||
    arrayBuffer: () => Promise.resolve(new ArrayBuffer(0)),
 | 
			
		||||
    blob: () => Promise.resolve(new Blob()),
 | 
			
		||||
    formData: () => Promise.resolve(new FormData()),
 | 
			
		||||
    text: () => Promise.resolve(""),
 | 
			
		||||
  } as Response),
 | 
			
		||||
  }),
 | 
			
		||||
);
 | 
			
		||||
 
 | 
			
		||||
@@ -17,8 +17,8 @@
 | 
			
		||||
    "prompts": "node ./scripts/fetch-prompts.mjs",
 | 
			
		||||
    "prepare": "husky install",
 | 
			
		||||
    "proxy-dev": "sh ./scripts/init-proxy.sh && proxychains -f ./scripts/proxychains.conf yarn dev",
 | 
			
		||||
    "test": "node --no-warnings --experimental-vm-modules $(yarn bin jest) --watch",
 | 
			
		||||
    "test:ci": "node --no-warnings --experimental-vm-modules $(yarn bin jest) --ci"
 | 
			
		||||
    "test": "jest --watch",
 | 
			
		||||
    "test:ci": "jest --ci"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@fortaine/fetch-event-source": "^3.0.6",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
import { jest } from "@jest/globals";
 | 
			
		||||
import { isVisionModel } from "../app/utils";
 | 
			
		||||
 | 
			
		||||
describe("isVisionModel", () => {
 | 
			
		||||
@@ -51,7 +50,7 @@ describe("isVisionModel", () => {
 | 
			
		||||
 | 
			
		||||
  test("should identify models from VISION_MODELS env var", () => {
 | 
			
		||||
    process.env.VISION_MODELS = "custom-vision-model,another-vision-model";
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    expect(isVisionModel("custom-vision-model")).toBe(true);
 | 
			
		||||
    expect(isVisionModel("another-vision-model")).toBe(true);
 | 
			
		||||
    expect(isVisionModel("unrelated-model")).toBe(false);
 | 
			
		||||
@@ -65,4 +64,4 @@ describe("isVisionModel", () => {
 | 
			
		||||
    expect(isVisionModel("unrelated-model")).toBe(false);
 | 
			
		||||
    expect(isVisionModel("gpt-4-vision")).toBe(true);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user