chore: update port to 4000 in tests and compose
This commit is contained in:
+6
-6
@@ -151,7 +151,7 @@ describe('File Route Handlers', () => {
|
||||
it('should return 404 if file is not found in database', async () => {
|
||||
mockFindByPublicId.mockImplementationOnce(async () => null);
|
||||
|
||||
const req = requestWithPublicId('http://localhost:3000/f/missing-id', 'missing-id');
|
||||
const req = requestWithPublicId('http://localhost:4000/f/missing-id', 'missing-id');
|
||||
const res = await handleFileRedirect(req);
|
||||
expect(res.status).toBe(404);
|
||||
const body = await responseJson<ErrorBody>(res);
|
||||
@@ -187,7 +187,7 @@ describe('File Route Handlers', () => {
|
||||
updatedAt: new Date('2026-05-18T00:00:00.000Z'),
|
||||
}));
|
||||
|
||||
const req = requestWithPublicId('http://localhost:3000/f/test-id', 'test-id');
|
||||
const req = requestWithPublicId('http://localhost:4000/f/test-id', 'test-id');
|
||||
const res = await handleFileRedirect(req);
|
||||
|
||||
expect(res.status).toBe(302);
|
||||
@@ -201,7 +201,7 @@ describe('File Route Handlers', () => {
|
||||
throw new Error('DB Connection Error');
|
||||
});
|
||||
|
||||
const req = requestWithPublicId('http://localhost:3000/f/test-id', 'test-id');
|
||||
const req = requestWithPublicId('http://localhost:4000/f/test-id', 'test-id');
|
||||
const res = await handleFileRedirect(req);
|
||||
expect(res.status).toBe(500);
|
||||
const body = await responseJson<ErrorBody>(res);
|
||||
@@ -213,7 +213,7 @@ describe('File Route Handlers', () => {
|
||||
it('should return 404 if file is not found in database', async () => {
|
||||
mockFindByPublicId.mockImplementationOnce(async () => null);
|
||||
|
||||
const req = requestWithPublicId('http://localhost:3000/file/missing-id/info', 'missing-id');
|
||||
const req = requestWithPublicId('http://localhost:4000/file/missing-id/info', 'missing-id');
|
||||
const res = await handleFileInfo(req);
|
||||
expect(res.status).toBe(404);
|
||||
const body = await responseJson<ErrorBody>(res);
|
||||
@@ -251,7 +251,7 @@ describe('File Route Handlers', () => {
|
||||
|
||||
mockFindByPublicId.mockImplementationOnce(async () => dbFile);
|
||||
|
||||
const req = requestWithPublicId('http://localhost:3000/file/test-id/info', 'test-id');
|
||||
const req = requestWithPublicId('http://localhost:4000/file/test-id/info', 'test-id');
|
||||
const res = await handleFileInfo(req);
|
||||
expect(res.status).toBe(200);
|
||||
const body = await responseJson<FileInfoBody>(res);
|
||||
@@ -273,7 +273,7 @@ describe('File Route Handlers', () => {
|
||||
throw new Error('DB Connection Error');
|
||||
});
|
||||
|
||||
const req = requestWithPublicId('http://localhost:3000/file/test-id/info', 'test-id');
|
||||
const req = requestWithPublicId('http://localhost:4000/file/test-id/info', 'test-id');
|
||||
const res = await handleFileInfo(req);
|
||||
expect(res.status).toBe(500);
|
||||
const body = await responseJson<ErrorBody>(res);
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ describe('Health Route Handler', () => {
|
||||
});
|
||||
|
||||
it('should return status 200 and ok when DB is healthy', async () => {
|
||||
const req = new Request('http://localhost:3000/health');
|
||||
const req = new Request('http://localhost:4000/health');
|
||||
const res = await handleHealth(req);
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
@@ -30,7 +30,7 @@ describe('Health Route Handler', () => {
|
||||
|
||||
it('should return status 500 and error details when DB health check fails', async () => {
|
||||
mockExecute.mockImplementationOnce(() => Promise.reject(new Error('DB Connection Failed')));
|
||||
const req = new Request('http://localhost:3000/health');
|
||||
const req = new Request('http://localhost:4000/health');
|
||||
const res = await handleHealth(req);
|
||||
|
||||
expect(res.status).toBe(500);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { afterAll, beforeAll, describe, expect, it, mock } from 'bun:test';
|
||||
process.env.NODE_ENV = 'test';
|
||||
process.env.BOT_TOKEN = '123456:ABC-DEF';
|
||||
process.env.STORAGE_CHANNEL_ID = '-1001234567890';
|
||||
process.env.BASE_URL = 'http://localhost:3000';
|
||||
process.env.BASE_URL = 'http://localhost:4000';
|
||||
process.env.DATABASE_URL = 'postgresql://localhost/test';
|
||||
process.env.PORT = '3000';
|
||||
process.env.S3_ACCESS_KEY = 'filedrop-admin';
|
||||
@@ -90,7 +90,7 @@ describe('S3 bucket configuration compatibility', () => {
|
||||
});
|
||||
|
||||
it('returns VersioningConfiguration for path-style GetBucketVersioning', async () => {
|
||||
const res = await handleS3Request(new Request('http://localhost:3000/gitea?versioning'));
|
||||
const res = await handleS3Request(new Request('http://localhost:4000/gitea?versioning'));
|
||||
const body = await res.text();
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
@@ -101,7 +101,7 @@ describe('S3 bucket configuration compatibility', () => {
|
||||
|
||||
it('returns VersioningConfiguration for virtual-hosted GetBucketVersioning', async () => {
|
||||
const res = await handleS3Request(
|
||||
new Request('http://gitea.localhost:3000/?versioning'),
|
||||
new Request('http://gitea.localhost:4000/?versioning'),
|
||||
'gitea',
|
||||
);
|
||||
const body = await res.text();
|
||||
|
||||
+7
-7
@@ -117,7 +117,7 @@ describe('Upload Route Handler', () => {
|
||||
});
|
||||
|
||||
it('should reject unsupported content types with 400 status', async () => {
|
||||
const req = new Request('http://localhost:3000/api/upload', {
|
||||
const req = new Request('http://localhost:4000/api/upload', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'text/plain',
|
||||
@@ -132,7 +132,7 @@ describe('Upload Route Handler', () => {
|
||||
});
|
||||
|
||||
it('should process JSON upload (base64) successfully', async () => {
|
||||
const req = new Request('http://localhost:3000/api/upload', {
|
||||
const req = new Request('http://localhost:4000/api/upload', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
@@ -160,7 +160,7 @@ describe('Upload Route Handler', () => {
|
||||
});
|
||||
|
||||
it('should reject JSON upload without file key', async () => {
|
||||
const req = new Request('http://localhost:3000/api/upload', {
|
||||
const req = new Request('http://localhost:4000/api/upload', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
@@ -181,7 +181,7 @@ describe('Upload Route Handler', () => {
|
||||
const fileBlob = new Blob([realPhotoBuffer], { type: 'image/png' });
|
||||
formData.append('file', fileBlob, 'test_multi.png');
|
||||
|
||||
const req = new Request('http://localhost:3000/api/upload', {
|
||||
const req = new Request('http://localhost:4000/api/upload', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
});
|
||||
@@ -214,7 +214,7 @@ describe('Upload Route Handler', () => {
|
||||
const fileBlob = new Blob([Buffer.from('multipart hello')], { type: 'text/plain' });
|
||||
formData.append('file', fileBlob, 'test_multi.txt');
|
||||
|
||||
const req = new Request('http://localhost:3000/api/upload', {
|
||||
const req = new Request('http://localhost:4000/api/upload', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
});
|
||||
@@ -252,7 +252,7 @@ describe('Upload Route Handler', () => {
|
||||
updatedAt: new Date('2026-05-18T00:00:00.000Z'),
|
||||
};
|
||||
|
||||
const req = new Request('http://localhost:3000/api/upload', {
|
||||
const req = new Request('http://localhost:4000/api/upload', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
@@ -281,7 +281,7 @@ describe('Upload Route Handler', () => {
|
||||
});
|
||||
|
||||
it('should reject oversized request by Content-Length header', async () => {
|
||||
const req = new Request('http://localhost:3000/api/upload', {
|
||||
const req = new Request('http://localhost:4000/api/upload', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
|
||||
@@ -58,7 +58,7 @@ describe('Web API v1', () => {
|
||||
beforeAll(async () => {
|
||||
process.env.BOT_TOKEN = '123456:ABC-DEF';
|
||||
process.env.STORAGE_CHANNEL_ID = '-1001234567890';
|
||||
process.env.BASE_URL = 'http://localhost:3000';
|
||||
process.env.BASE_URL = 'http://localhost:4000';
|
||||
process.env.DATABASE_URL = 'postgresql://localhost/test';
|
||||
const webApi = await import('../src/interfaces/http/controllers/web-api-controller');
|
||||
handleWebApiV1 = webApi.handleWebApiV1;
|
||||
@@ -74,7 +74,7 @@ describe('Web API v1', () => {
|
||||
});
|
||||
|
||||
it('should list buckets via GET /api/v1/buckets', async () => {
|
||||
const req = new Request('http://localhost:3000/api/v1/buckets');
|
||||
const req = new Request('http://localhost:4000/api/v1/buckets');
|
||||
const res = await handleWebApiV1(req);
|
||||
expect(res.status).toBe(200);
|
||||
const data = (await res.json()) as { buckets: { name: string }[] };
|
||||
@@ -84,7 +84,7 @@ describe('Web API v1', () => {
|
||||
});
|
||||
|
||||
it('should return 404 for unknown API path', async () => {
|
||||
const req = new Request('http://localhost:3000/api/v1/unknown');
|
||||
const req = new Request('http://localhost:4000/api/v1/unknown');
|
||||
const res = await handleWebApiV1(req);
|
||||
expect(res.status).toBe(404);
|
||||
const data = (await res.json()) as { error: string };
|
||||
@@ -92,7 +92,7 @@ describe('Web API v1', () => {
|
||||
});
|
||||
|
||||
it('should return 400 for invalid bucket name on create', async () => {
|
||||
const req = new Request('http://localhost:3000/api/v1/buckets', {
|
||||
const req = new Request('http://localhost:4000/api/v1/buckets', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: JSON.stringify({ name: 'INVALID_NAME!' }),
|
||||
@@ -117,7 +117,7 @@ describe('Web API v1', () => {
|
||||
},
|
||||
];
|
||||
|
||||
const req = new Request('http://localhost:3000/api/v1/buckets/test-bucket/objects');
|
||||
const req = new Request('http://localhost:4000/api/v1/buckets/test-bucket/objects');
|
||||
const res = await handleWebApiV1(req);
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
|
||||
Reference in New Issue
Block a user