<commit_before>import { ObjectId } from '@mikro-orm/mongodb';
import { Coursegroup } from './coursegroup.entity';
// import { Course } from './course.entity';

describe('CourseEntity', () => {
	describe('constructor', () => {
		it('should throw an error by empty constructor', () => {
			// @ts-expect-error: Test case
			const test = () => new Coursegroup();
			expect(test).toThrow();
		});

		it('should create a course by passing right properties', () => {
			// const schoolId = new ObjectId().toHexString();
			// const course = new Course({ name: '', schoolId });
			const courseId = new ObjectId().toHexString();
			const coursegroup = new Coursegroup({ courseId });
			expect(coursegroup instanceof Coursegroup).toEqual(true);
		});
	});

	describe('isMember', () => {
		it('should return false for empty members', () => {
			const courseId = new ObjectId().toHexString();
			const userId = new ObjectId().toHexString();
			const coursegroup = new Coursegroup({ courseId, studentIds: [] });

			const result = coursegroup.isMember(userId);
			expect(result).toBeFalsy();
		});

		it('should true if userId is member', () => {
			const courseId = new ObjectId().toHexString();
			const userId = new ObjectId().toHexString();
			const coursegroup = new Coursegroup({ courseId, studentIds: [userId] });

			const result = coursegroup.isMember(userId);
			expect(result).toBeTruthy();
		});

		it('should false if userId is not member of studentIds', () => {
			const courseId = new ObjectId().toHexString();<commit_msg>remove unused comment<commit_after>import { ObjectId } from '@mikro-orm/mongodb';
import { Coursegroup } from './coursegroup.entity';
// import { Course } from './course.entity';

describe('CourseEntity', () => {
	describe('constructor', () => {
		it('should throw an error by empty constructor', () => {
			// @ts-expect-error: Test case
			const test = () => new Coursegroup();
			expect(test).toThrow();
		});

		it('should create a course by passing right properties', () => {
			const courseId = new ObjectId().toHexString();
			const coursegroup = new Coursegroup({ courseId });
			expect(coursegroup instanceof Coursegroup).toEqual(true);
		});
	});

	describe('isMember', () => {
		it('should return false for empty members', () => {
			const courseId = new ObjectId().toHexString();
			const userId = new ObjectId().toHexString();
			const coursegroup = new Coursegroup({ courseId, studentIds: [] });

			const result = coursegroup.isMember(userId);
			expect(result).toBeFalsy();
		});

		it('should true if userId is member', () => {
			const courseId = new ObjectId().toHexString();
			const userId = new ObjectId().toHexString();
			const coursegroup = new Coursegroup({ courseId, studentIds: [userId] });

			const result = coursegroup.isMember(userId);
			expect(result).toBeTruthy();
		});

		it('should false if userId is not member of studentIds', () => {
			const courseId = new ObjectId().toHexString();
{'fraction_non_alphanumeric': 0.16451831750339213, 'fraction_numerical': 0.0, 'mean_word_length': 4.155594405594406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4627447', 'n_tokens_mistral': 939, 'n_tokens_neox': 842, 'n_words': 235}