- {profileUser?.image ? (
-
{profileUser?.username}
{profileUser?.email && (
diff --git a/docker-compose.yml b/docker-compose.yml
index e56800f..9976879 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,4 +1,3 @@
-version: '3.8'
services:
mongodb:
diff --git a/jest.config.ts b/jest.config.js
similarity index 92%
rename from jest.config.ts
rename to jest.config.js
index 2fd2fa5..c944743 100644
--- a/jest.config.ts
+++ b/jest.config.js
@@ -1,7 +1,8 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
-export default {
+module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
+ testTimeout: 60000,
testMatch: ['**/**/*.test.ts'],
verbose: true,
forceExit: true,
diff --git a/package-lock.json b/package-lock.json
index b84e458..843123b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -48,6 +48,7 @@
"@types/swagger-jsdoc": "^6.0.4",
"@types/swagger-ui-express": "^4.1.8",
"concurrently": "^9.2.1",
+ "cross-env": "^10.1.0",
"jest": "^30.2.0",
"jest-html-reporter": "^4.3.0",
"nodemon": "^3.1.11",
@@ -753,6 +754,13 @@
"tslib": "^2.4.0"
}
},
+ "node_modules/@epic-web/invariant": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz",
+ "integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@finom/zod-to-json-schema": {
"version": "3.24.11",
"resolved": "https://registry.npmjs.org/@finom/zod-to-json-schema/-/zod-to-json-schema-3.24.11.tgz",
@@ -3333,6 +3341,24 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/cross-env": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.1.0.tgz",
+ "integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@epic-web/invariant": "^1.0.0",
+ "cross-spawn": "^7.0.6"
+ },
+ "bin": {
+ "cross-env": "dist/bin/cross-env.js",
+ "cross-env-shell": "dist/bin/cross-env-shell.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
diff --git a/package.json b/package.json
index efa0584..ce7ac74 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"dev": "concurrently \"npm run dev --prefix client\" \"nodemon src/server.ts\"",
"build": "npm run build --prefix client && tsc",
"start": "node dist/server.js",
- "test": "jest --detectOpenHandles --forceExit",
+ "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --detectOpenHandles --forceExit",
"seed": "ts-node src/seed.ts",
"seed:prod": "node dist/seed.js",
"client:install": "npm install --prefix client",
@@ -65,6 +65,7 @@
"@types/swagger-jsdoc": "^6.0.4",
"@types/swagger-ui-express": "^4.1.8",
"concurrently": "^9.2.1",
+ "cross-env": "^10.1.0",
"jest": "^30.2.0",
"jest-html-reporter": "^4.3.0",
"nodemon": "^3.1.11",
diff --git a/setup_runner.sh b/setup_runner.sh
deleted file mode 100644
index d0d21f9..0000000
--- a/setup_runner.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-# Capability Checks
-echo "--- Checking Server Capabilities ---"
-for cmd in docker git node npm; do
- if command -v $cmd &> /dev/null; then
- echo "✅ $cmd is installed: $($cmd --version | head -n 1)"
- else
- echo "❌ $cmd is NOT installed!"
- fi
-done
-echo "------------------------------------"
-
-# Configuration
-# MarketWatchWeb - Self-Hosted Runner Setup Script
-# Run this on the node65 server
-
-# 1. Create a folder
-mkdir -p actions-runner && cd actions-runner
-
-# 2. Download the latest runner package
-curl -o actions-runner-linux-x64-2.332.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.332.0/actions-runner-linux-x64-2.332.0.tar.gz
-
-# 3. Extract the installer
-tar xzf ./actions-runner-linux-x64-2.332.0.tar.gz
-
-# 4. Configure the runner
-echo "--------------------------------------------------------"
-echo "Go to Settings -> Actions -> Runners -> New self-hosted runner"
-echo "Copy the --token value and paste it when prompted below."
-echo "--------------------------------------------------------"
-
-# Run config.sh
-./config.sh || { echo "❌ Configuration failed! Cleaning up..."; exit 1; }
-
-# 5. Install as a service so it runs in the background
-sudo ./svc.sh install
-sudo ./svc.sh start
-
-echo "✅ Runner is now installed and started as a service!"
diff --git a/src/app.ts b/src/app.ts
index 8485a26..7432a72 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -14,13 +14,21 @@ import { setupPassport } from './config/passport';
-dotenv.config();
+if (process.env.NODE_ENV !== 'test') {
+ dotenv.config();
+}
const app: Express = express();
// Security Middlewares
app.use(helmet({
- crossOriginResourcePolicy: false, // allow images to be served cross origin
+ crossOriginResourcePolicy: false,
+ contentSecurityPolicy: {
+ directives: {
+ ...helmet.contentSecurityPolicy.getDefaultDirectives(),
+ "img-src": ["'self'", "data:", "https://images.unsplash.com", "https://api.dicebear.com", "https://*.unsplash.com"],
+ },
+ },
}));
// Rate limiting to prevent brute force / DDoS
@@ -60,6 +68,19 @@ app.use(passport.initialize());
// Static folder for uploaded files (Images)
app.use('/uploads', express.static('src/uploads'));
+// Swagger Documentation (Moved UP to avoid SPA fallback interception)
+setupSwagger(app);
+
+// Serve Jest Test Report (Moved UP to avoid SPA fallback interception)
+app.get('/test-report', (req, res) => {
+ const reportPath = path.join(__dirname, '../test-report.html');
+ if (fs.existsSync(reportPath)) {
+ res.sendFile(reportPath);
+ } else {
+ res.status(404).send('
Test Report Not Available
Run npm test to generate the latest report.
');
+ }
+});
+
// Serve frontend static files BEFORE API routes to prevent overlapping paths (like /watchlist)
// from hitting the backend API instead of the React app on direct browser navigation.
if (process.env.NODE_ENV !== 'development') {
@@ -80,19 +101,6 @@ if (process.env.NODE_ENV !== 'development') {
});
}
-// Swagger Documentation
-setupSwagger(app);
-
-// Serve Jest Test Report
-app.get('/test-report', (req, res) => {
- const reportPath = path.join(__dirname, '../test-report.html');
- if (fs.existsSync(reportPath)) {
- res.sendFile(reportPath);
- } else {
- res.status(404).send('
Test Report Not Available
Run npm test to generate the latest report.
');
- }
-});
-
// Routes
app.use('/auth', authRoutes);
const userRoutes = userRoutesModule.default;
diff --git a/src/config/passport.ts b/src/config/passport.ts
index 4a3c17c..40d8d69 100644
--- a/src/config/passport.ts
+++ b/src/config/passport.ts
@@ -5,39 +5,41 @@ import User, { IUser } from '../models/user_model';
import mongoose from 'mongoose';
export const setupPassport = (): void => {
- // Google OAuth Strategy
- passport.use(
- new GoogleStrategy(
- {
- clientID: process.env.GOOGLE_CLIENT_ID || '',
- clientSecret: process.env.GOOGLE_CLIENT_SECRET || '',
- callbackURL: process.env.GOOGLE_CALLBACK_URL || 'http://localhost:3000/auth/google/callback'
- },
- async (accessToken: string, refreshToken: string, profile: Profile, done: VerifyCallback) => {
- try {
- // Check if user already exists
- let user = await User.findOne({ email: profile.emails?.[0].value });
+ if (process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET) {
+ // Google OAuth Strategy
+ passport.use(
+ new GoogleStrategy(
+ {
+ clientID: process.env.GOOGLE_CLIENT_ID,
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET,
+ callbackURL: process.env.GOOGLE_CALLBACK_URL || 'http://localhost:3000/auth/google/callback'
+ },
+ async (accessToken: string, refreshToken: string, profile: Profile, done: VerifyCallback) => {
+ try {
+ // Check if user already exists
+ let user = await User.findOne({ email: profile.emails?.[0].value });
- if (user) {
- // User exists, return it
- return done(null, user as any);
- }
+ if (user) {
+ // User exists, return it
+ return done(null, user as any);
+ }
- // Create new user
- user = await User.create({
- email: profile.emails?.[0].value,
- username: profile.displayName || profile.emails?.[0].value.split('@')[0],
- password: Math.random().toString(36).slice(-8) + Math.random().toString(36).slice(-8), // Random password for OAuth users
- image: profile.photos?.[0].value || ''
- });
+ // Create new user
+ user = await User.create({
+ email: profile.emails?.[0].value,
+ username: profile.displayName || profile.emails?.[0].value.split('@')[0],
+ password: Math.random().toString(36).slice(-8) + Math.random().toString(36).slice(-8), // Random password for OAuth users
+ image: profile.photos?.[0].value || ''
+ });
- done(null, user as any);
- } catch (error) {
- done(error as Error, undefined);
+ done(null, user as any);
+ } catch (error) {
+ done(error as Error, undefined);
+ }
}
- }
- )
- );
+ )
+ );
+ }
/*
// Facebook OAuth Strategy
diff --git a/src/controllers/auth_controller.ts b/src/controllers/auth_controller.ts
index f4f64f7..95c53fd 100644
--- a/src/controllers/auth_controller.ts
+++ b/src/controllers/auth_controller.ts
@@ -27,7 +27,8 @@ const register = async (req: Request, res: Response) => {
if (exists) return res.status(400).send("User already exists");
- const salt = await bcrypt.genSalt(10);
+ const saltRounds = parseInt(process.env.BCRYPT_SALT_ROUNDS || '10');
+ const salt = await bcrypt.genSalt(saltRounds);
const hashedPassword = await bcrypt.hash(password, salt);
const user = new User({ email, password: hashedPassword, username });
diff --git a/src/models/stock_alert_model.ts b/src/models/stock_alert_model.ts
index fe19e76..f611216 100644
--- a/src/models/stock_alert_model.ts
+++ b/src/models/stock_alert_model.ts
@@ -39,7 +39,8 @@ const StockAlertSchema: Schema = new Schema({
}
});
-// Index for efficient querying by background worker
+// Efficient multi-field indexing for faster lookup by worker and user queries
+StockAlertSchema.index({ user: 1, createdAt: -1 });
StockAlertSchema.index({ isTriggered: 1, symbol: 1 });
export default mongoose.model
('StockAlert', StockAlertSchema);
diff --git a/src/routes/stock_routes.ts b/src/routes/stock_routes.ts
index f6fd77d..576e2cf 100644
--- a/src/routes/stock_routes.ts
+++ b/src/routes/stock_routes.ts
@@ -156,11 +156,13 @@ router.put('/alerts/:id', authMiddleware, stockController.updateAlert);
* 200:
* description: Alert deleted
*/
+router.delete('/alerts/:id', authMiddleware, stockController.deleteAlert);
+
/**
* @swagger
* /stocks/check-alerts:
* post:
- * summary: Manually trigger alert check (Dev/Verif purposes)
+ * summary: Manually trigger alert check
* tags: [Stocks]
* security:
* - bearerAuth: []
diff --git a/src/services/gemini_service.ts b/src/services/gemini_service.ts
index b14b6a5..44993b4 100644
--- a/src/services/gemini_service.ts
+++ b/src/services/gemini_service.ts
@@ -17,28 +17,32 @@ class GeminiService {
const openRouterKey = process.env.OPENROUTER_API_KEY;
const geminiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY;
- if (openRouterKey && openRouterKey.startsWith("sk-or-")) {
- console.log("Initializing LlamaIndex with OpenRouter");
+ // More flexible key check: if it exists and isn't a placeholder
+ const isValidKey = (key: string | undefined) =>
+ key && key.length > 10 && !key.includes('your-');
+
+ if (isValidKey(openRouterKey)) {
+ console.log("Initializing AI service with OpenRouter");
this.llm = new OpenAI({
apiKey: openRouterKey,
model: "google/gemini-2.0-flash-001",
additionalChatOptions: {
// @ts-ignore
headers: {
- "HTTP-Referer": "http://localhost:3000",
- "X-Title": "MarketWatchWeb"
+ "HTTP-Referer": "https://node65.cs.colman.ac.il",
+ "X-Title": "MarketWatchWeb-Prod"
}
},
baseURL: "https://openrouter.ai/api/v1"
});
- } else if (geminiKey) {
- console.log("Initializing LlamaIndex with Google Gemini");
+ } else if (isValidKey(geminiKey)) {
+ console.log("Initializing AI service with Google Gemini native");
this.llm = new Gemini({
apiKey: geminiKey,
model: GEMINI_MODEL.GEMINI_2_0_FLASH
});
} else {
- console.warn("No AI API keys found. Please set OPENROUTER_API_KEY or GEMINI_API_KEY in .env");
+ console.warn("No valid AI API keys found. AI features will use fallbacks.");
}
if (this.llm) {
diff --git a/src/services/stock_service.ts b/src/services/stock_service.ts
index ebb5bf6..0823031 100644
--- a/src/services/stock_service.ts
+++ b/src/services/stock_service.ts
@@ -1,4 +1,5 @@
import YahooFinance from 'yahoo-finance2';
+import mongoose from 'mongoose';
import StockAlert, { IStockAlert } from '../models/stock_alert_model';
import User from '../models/user_model';
@@ -37,8 +38,9 @@ const getHistoricalData = async (symbol: string, period1: string, period2: strin
};
const createAlert = async (userId: string, symbol: string, targetPrice: number, condition: 'ABOVE' | 'BELOW') => {
+ const userObjectId = new mongoose.Types.ObjectId(userId);
const alert = new StockAlert({
- user: userId,
+ user: userObjectId,
symbol,
targetPrice,
condition
@@ -47,14 +49,21 @@ const createAlert = async (userId: string, symbol: string, targetPrice: number,
};
const getUserAlerts = async (userId: string) => {
- return await StockAlert.find({ user: userId, isTriggered: false }).sort({ createdAt: -1 });
+ try {
+ // Mongoose automatically casts the string userId to an ObjectId
+ return await StockAlert.find({ user: userId }).sort({ createdAt: -1 });
+ } catch (err) {
+ console.error(`Error loading alerts for user ${userId}:`, err);
+ throw new Error('Failed to load alerts');
+ }
};
const deleteAlert = async (alertId: string, userId: string) => {
- return await StockAlert.findOneAndDelete({ _id: alertId, user: userId });
+ const userObjectId = new mongoose.Types.ObjectId(userId);
+ return await StockAlert.findOneAndDelete({ _id: alertId, user: userObjectId });
};
-// Check alerts logic (to be called by worker)
+// Check all active alerts against current market prices
const checkAlerts = async () => {
const activeAlerts = await StockAlert.find({ isTriggered: false });
const symbols = [...new Set(activeAlerts.map(a => a.symbol))]; // Unique symbols
@@ -76,10 +85,8 @@ const checkAlerts = async () => {
}
if (triggered) {
- alert.isTriggered = true;
- await alert.save();
- // In a real app, send email/push notification here
- console.log(`ALERT TRIGGERED: ${symbol} is ${alert.condition} ${alert.targetPrice} (Current: ${currentPrice})`);
+ await StockAlert.findByIdAndUpdate(alert._id, { isTriggered: true });
+ console.log(`Alert triggered for ${symbol}: ${alert.condition} ${alert.targetPrice} (Price: ${currentPrice})`);
}
}
} catch (err) {
@@ -89,8 +96,9 @@ const checkAlerts = async () => {
};
const updateAlert = async (alertId: string, userId: string, data: { targetPrice?: number; condition?: 'ABOVE' | 'BELOW' }) => {
+ const userObjectId = new mongoose.Types.ObjectId(userId);
return await StockAlert.findOneAndUpdate(
- { _id: alertId, user: userId },
+ { _id: alertId, user: userObjectId },
{ $set: data },
{ new: true }
);
diff --git a/src/swagger.ts b/src/swagger.ts
index 9ab1087..b7f0fdc 100644
--- a/src/swagger.ts
+++ b/src/swagger.ts
@@ -1,6 +1,7 @@
import swaggerJsdoc from 'swagger-jsdoc';
import swaggerUi from 'swagger-ui-express';
import { Express } from 'express';
+import path from 'path';
const options: swaggerJsdoc.Options = {
definition: {
@@ -87,7 +88,16 @@ const options: swaggerJsdoc.Options = {
}
]
},
- apis: ['./src/routes/*.ts', './src/controllers/*.ts']
+ apis: [
+ path.join(__dirname, './routes/*.ts'),
+ path.join(__dirname, './controllers/*.ts'),
+ path.join(__dirname, './dist/routes/*.js'),
+ path.join(__dirname, './dist/controllers/*.js'),
+ path.join(__dirname, '../dist/routes/*.js'),
+ path.join(__dirname, '../dist/controllers/*.js'),
+ './src/routes/*.ts',
+ './src/controllers/*.ts'
+ ]
};
const swaggerSpec = swaggerJsdoc(options);
diff --git a/src/tests/ai.test.ts b/src/tests/ai.test.ts
index 4e876f3..5e6f298 100644
--- a/src/tests/ai.test.ts
+++ b/src/tests/ai.test.ts
@@ -1,3 +1,4 @@
+process.env.NODE_ENV = 'test';
import request from 'supertest';
import mongoose from 'mongoose';
import app from '../app';
@@ -6,8 +7,11 @@ import Post from '../models/post_model';
const TEST_DB_URI = process.env.MONGO_URI || 'mongodb://127.0.0.1:27017/market_watch_test_db';
-// Check if Gemini API key is configured
-const hasGeminiKey = process.env.GEMINI_API_KEY && process.env.GEMINI_API_KEY !== 'your-gemini-api-key-here';
+jest.setTimeout(60000);
+
+// Check if AI API keys are configured correctly
+const isValid = (k: string | undefined) => k && k.length > 10 && !k.includes('your-');
+const hasAIKey = isValid(process.env.GEMINI_API_KEY) || isValid(process.env.OPENROUTER_API_KEY);
beforeAll(async () => {
if (mongoose.connection.readyState === 0) {
@@ -24,7 +28,7 @@ beforeEach(async () => {
await Post.deleteMany({});
});
-const describeIfConfigured = hasGeminiKey ? describe : describe.skip;
+const describeIfConfigured = hasAIKey ? describe : describe.skip;
describeIfConfigured('AI API (requires GEMINI_API_KEY)', () => {
const testUser = {
diff --git a/src/tests/auth.test.ts b/src/tests/auth.test.ts
index 247bdcc..c9560a8 100644
--- a/src/tests/auth.test.ts
+++ b/src/tests/auth.test.ts
@@ -1,3 +1,4 @@
+process.env.NODE_ENV = 'test';
import request from 'supertest';
import mongoose from 'mongoose';
import app from '../app';
@@ -5,8 +6,12 @@ import User from '../models/user_model';
const TEST_DB_URI = process.env.MONGO_URI || 'mongodb://127.0.0.1:27017/market_watch_test_db';
+jest.setTimeout(60000);
+
beforeAll(async () => {
- await mongoose.connect(TEST_DB_URI);
+ if (mongoose.connection.readyState === 0) {
+ await mongoose.connect(TEST_DB_URI);
+ }
});
afterAll(async () => {
diff --git a/src/tests/comment.test.ts b/src/tests/comment.test.ts
index 9d0667a..4b2b3e9 100644
--- a/src/tests/comment.test.ts
+++ b/src/tests/comment.test.ts
@@ -1,3 +1,4 @@
+process.env.NODE_ENV = 'test';
import request from 'supertest';
import mongoose from 'mongoose';
import app from '../app';
@@ -7,6 +8,8 @@ import Comment from '../models/comment_model';
const TEST_DB_URI = process.env.MONGO_URI || 'mongodb://127.0.0.1:27017/market_watch_test_db';
+jest.setTimeout(60000);
+
beforeAll(async () => {
if (mongoose.connection.readyState === 0) {
await mongoose.connect(TEST_DB_URI);
diff --git a/src/tests/post.test.ts b/src/tests/post.test.ts
index 1e938d4..0a9b5f1 100644
--- a/src/tests/post.test.ts
+++ b/src/tests/post.test.ts
@@ -1,3 +1,4 @@
+process.env.NODE_ENV = 'test';
import request from 'supertest';
import mongoose from 'mongoose';
import app from '../app';
@@ -6,11 +7,13 @@ import Post from '../models/post_model';
const TEST_DB_URI = process.env.MONGO_URI || 'mongodb://127.0.0.1:27017/market_watch_test_db';
+jest.setTimeout(60000);
+
beforeAll(async () => {
if (mongoose.connection.readyState === 0) {
await mongoose.connect(TEST_DB_URI);
}
-});
+}, 30000);
afterAll(async () => {
await mongoose.connection.close();
diff --git a/src/tests/stock_alert.test.ts b/src/tests/stock_alert.test.ts
new file mode 100644
index 0000000..5057363
--- /dev/null
+++ b/src/tests/stock_alert.test.ts
@@ -0,0 +1,160 @@
+process.env.NODE_ENV = 'test';
+import request from 'supertest';
+import mongoose from 'mongoose';
+import app from '../app';
+import User from '../models/user_model';
+import StockAlert from '../models/stock_alert_model';
+
+const TEST_DB_URI = process.env.MONGO_URI || 'mongodb://127.0.0.1:27017/market_watch_test_db';
+
+jest.setTimeout(60000);
+
+beforeAll(async () => {
+ await mongoose.connect(TEST_DB_URI);
+});
+
+afterAll(async () => {
+ await mongoose.connection.close();
+});
+
+beforeEach(async () => {
+ try {
+ await User.deleteMany({});
+ await StockAlert.deleteMany({});
+ } catch (err) {
+ console.error('Cleanup failed:', err);
+ }
+});
+
+describe('Stock Alert API', () => {
+ const testUser = {
+ email: 'alert_test@example.com',
+ username: 'alertuser',
+ password: 'password123',
+ };
+
+ let userToken: string;
+ let userId: string;
+
+ beforeEach(async () => {
+ const reg = await request(app).post('/auth/register').send(testUser);
+ userId = reg.body._id;
+ const login = await request(app).post('/auth/login').send({
+ username: testUser.username,
+ password: testUser.password
+ });
+ userToken = login.body.accessToken;
+ });
+
+ describe('POST /stocks/alerts', () => {
+ it('should create a new alert', async () => {
+ const alertData = {
+ symbol: 'AAPL',
+ targetPrice: 200,
+ condition: 'ABOVE'
+ };
+
+ const res = await request(app)
+ .post('/stocks/alerts')
+ .set('Authorization', `Bearer ${userToken}`)
+ .send(alertData);
+
+ expect(res.statusCode).toBe(201);
+ expect(res.body.symbol).toBe('AAPL');
+ expect(res.body.targetPrice).toBe(200);
+ expect(res.body.condition).toBe('ABOVE');
+ expect(res.body.user).toBe(userId);
+ });
+
+ it('should fail to create alert without authentication', async () => {
+ const res = await request(app).post('/stocks/alerts').send({
+ symbol: 'AAPL',
+ targetPrice: 200,
+ condition: 'ABOVE'
+ });
+ expect(res.statusCode).toBe(401);
+ });
+ });
+
+ describe('GET /stocks/alerts', () => {
+ it('should get all alerts including triggered ones', async () => {
+ // Create one active and one triggered alert
+ const activeAlert = new StockAlert({
+ user: userId,
+ symbol: 'MSFT',
+ targetPrice: 400,
+ condition: 'ABOVE',
+ isTriggered: false
+ });
+ await activeAlert.save();
+
+ const triggeredAlert = new StockAlert({
+ user: userId,
+ symbol: 'GOOGL',
+ targetPrice: 150,
+ condition: 'BELOW',
+ isTriggered: true
+ });
+ await triggeredAlert.save();
+
+ const res = await request(app)
+ .get('/stocks/alerts')
+ .set('Authorization', `Bearer ${userToken}`);
+
+ expect(res.statusCode).toBe(200);
+ expect(res.body).toHaveLength(2);
+
+ const symbols = res.body.map((a: any) => a.symbol);
+ expect(symbols).toContain('MSFT');
+ expect(symbols).toContain('GOOGL');
+
+ const triggered = res.body.find((a: any) => a.symbol === 'GOOGL');
+ expect(triggered.isTriggered).toBe(true);
+ });
+ });
+
+ describe('PUT /stocks/alerts/:id', () => {
+ it('should update an alert', async () => {
+ const alert = new StockAlert({
+ user: userId,
+ symbol: 'TSLA',
+ targetPrice: 250,
+ condition: 'ABOVE'
+ });
+ await alert.save();
+
+ const res = await request(app)
+ .put(`/stocks/alerts/${alert._id}`)
+ .set('Authorization', `Bearer ${userToken}`)
+ .send({ targetPrice: 300 });
+
+ expect(res.statusCode).toBe(200);
+ expect(res.body.targetPrice).toBe(300);
+ });
+ });
+
+ describe('DELETE /stocks/alerts/:id', () => {
+ it('should delete an alert', async () => {
+ const alert = new StockAlert({
+ user: userId,
+ symbol: 'AMD',
+ targetPrice: 180,
+ condition: 'BELOW'
+ });
+ await alert.save();
+
+ const res = await request(app)
+ .delete(`/stocks/alerts/${alert._id}`)
+ .set('Authorization', `Bearer ${userToken}`);
+
+ expect(res.statusCode).toBe(200);
+ expect(res.body.message).toBe("Alert deleted");
+
+ // Verify it's gone
+ const checkRes = await request(app)
+ .get('/stocks/alerts')
+ .set('Authorization', `Bearer ${userToken}`);
+ expect(checkRes.body).toHaveLength(0);
+ });
+ });
+});
diff --git a/src/tests/user.test.ts b/src/tests/user.test.ts
index 1c8dcc0..6e057ad 100644
--- a/src/tests/user.test.ts
+++ b/src/tests/user.test.ts
@@ -1,3 +1,4 @@
+process.env.NODE_ENV = 'test';
import request from 'supertest';
import mongoose from 'mongoose';
import app from '../app';
@@ -5,6 +6,8 @@ import User from '../models/user_model';
const TEST_DB_URI = process.env.MONGO_URI || 'mongodb://127.0.0.1:27017/market_watch_test_db';
+jest.setTimeout(60000);
+
beforeAll(async () => {
if (mongoose.connection.readyState === 0) {
await mongoose.connect(TEST_DB_URI);
diff --git a/test-report.html b/test-report.html
index 1b604e6..1aeb006 100644
--- a/test-report.html
+++ b/test-report.html
@@ -274,447 +274,4 @@
font-size: 1rem;
padding: 0 0.5rem;
}
-MarketWatchWeb Test Report
C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts
64.706s
Post API > POST /posts
should create a new post when authenticated
failed
0.003s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > POST /posts
should fail to create post without authentication
failed
0.002s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > POST /posts
should fail to create post without title or content
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > GET /posts
should get all posts with pagination
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > GET /posts/:id
should get a specific post by ID
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > GET /posts/:id
should return 404 for non-existent post
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > PUT /posts/:id
should update own post
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > PUT /posts/:id
should not allow updating another user's post
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > DELETE /posts/:id
should delete own post
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > DELETE /posts/:id
should not allow deleting another user's post
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > GET /posts/owner/:ownerId
should get posts by specific owner with pagination
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > GET /posts/owner/:ownerId
should get own posts when using /my-posts with pagination
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > POST /posts/:id/like
should like a post
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > POST /posts/:id/like
should not allow liking the same post twice
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > POST /posts/:id/like
should fail to like without authentication
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > POST /posts/:id/like
should return 404 for non-existent post
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > DELETE /posts/:id/like
should unlike a post
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > DELETE /posts/:id/like
should not allow unliking a post that was not liked
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Post API > DELETE /posts/:id/like
should fail to unlike without authentication
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\post.test.ts:9:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at processTicksAndRejections (node:internal/process/task_queues:105:5)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts
13.072s
Comment API > POST /posts/:postId/comments
should create a comment on a post
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > POST /posts/:postId/comments
should fail to create comment without authentication
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > POST /posts/:postId/comments
should fail to create comment without content
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > POST /posts/:postId/comments
should fail to create comment on non-existent post
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > GET /posts/:postId/comments
should get all comments for a post with pagination
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > GET /posts/:postId/comments
should return empty array for post with no comments
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > GET /posts/:postId/comments
should return 404 for non-existent post
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > PUT /comments/:id
should update own comment
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > PUT /comments/:id
should not allow updating another user's comment
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > PUT /comments/:id
should fail to update without content
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > DELETE /comments/:id
should delete own comment
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > DELETE /comments/:id
should not allow deleting another user's comment
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Comment API > DELETE /comments/:id
should return 404 for non-existent comment
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\comment.test.ts:10:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\auth.test.ts
12.855s
Auth API > POST /auth/register
should register a new user successfully
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\auth.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Auth API > POST /auth/register
should fail to register with existing email
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\auth.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Auth API > POST /auth/login
should login successfully with valid credentials
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\auth.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Auth API > POST /auth/login
should fail login with invalid password
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\auth.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Auth API > Token Management
should refresh access token using valid refresh token
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\auth.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Auth API > Token Management
should fail refresh with invalid refresh token
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\auth.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
Auth API > Token Management
should logout successfully
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\auth.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts
12.54s
AI API (requires GEMINI_API_KEY) > POST /ai/analyze
should analyze a financial query
pending
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
AI API (requires GEMINI_API_KEY) > POST /ai/analyze
should fail without query
pending
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
AI API (requires GEMINI_API_KEY) > POST /ai/analyze
should require authentication
pending
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
AI API (requires GEMINI_API_KEY) > POST /ai/search
should perform smart search
pending
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
AI API (requires GEMINI_API_KEY) > POST /ai/suggestions
should generate post suggestions
pending
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
AI API (requires GEMINI_API_KEY) > GET /ai/analyze-post/:postId
should analyze a post
pending
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
AI API (requires GEMINI_API_KEY) > GET /ai/analyze-post/:postId
should return 404 for non-existent post
pending
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
AI API - Basic Tests
should require authentication for AI endpoints
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
AI API - Basic Tests
should validate input for analyze endpoint
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
AI API - Basic Tests
should validate input for search endpoint
failed
0.002s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\ai.test.ts:12:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\user.test.ts
12.774s
User API > GET /user/profile
should return user profile when authenticated
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\user.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
User API > GET /user/profile
should deny access without token
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\user.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
User API > PUT /user/update
should update username successfully
failed
0.001s
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\user.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)
User API > PUT /user/update
should update image URL successfully
failed
Error: thrown: "Exceeded timeout of 5000 ms for a hook.
-Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
- at Object.<anonymous> (C:\Users\User\Documents\GitHub\MarketWatchWeb\src\tests\user.test.ts:8:1)
- at Runtime._execModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:1268:24)
- at Runtime._loadModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:944:12)
- at Runtime.requireModule (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runtime\build\index.js:832:12)
- at jestAdapter (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-circus\build\runner.js:95:13)
- at async runTestInternal (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:275:16)
- at async runTest (C:\Users\User\Documents\GitHub\MarketWatchWeb\node_modules\jest-runner\build\index.js:343:7)