<commit_before>
import { Course } from '../../entities';
import { CourseEditComponent } from './courseEdit.component';
import { CoursesService, AuthorsService, NotificationService, BreadcrumbsService, ApiService } from '../../services';
import { ComponentFixture, TestBed, ComponentFixtureAutoDetect, async } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement, Component } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';

describe('CourseEdit component', () => {
    let fakeCoursesService;
    let coursesEditComponent: CourseEditComponent;
    let fixture: ComponentFixture<CourseEditComponent>;

    let route: ActivatedRoute;
    let router: Router;
    let formBuilder: FormBuilder;
    let authorsService: AuthorsService;
    let notification: NotificationService;
    let breadcrumbsService: BreadcrumbsService;
    let apiService: ApiService

    beforeEach(() => {
        fakeCoursesService = {
            addCourse: jasmine.createSpy(''),
            updateCourse: jasmine.createSpy('')

        };
        //spyOn(fakeCoursesService, 'addCourse');
        //spyOn(fakeCoursesService, 'updateCourse');

        TestBed.configureTestingModule({
            //imports: [Router],
            declarations: [CourseEditComponent],
            providers: [
                { provide: CoursesService, useValue: fakeCoursesService }
            ],
        }).compileComponents()
            .then(() => {
                fixture = TestBed.createComponent(CourseEditComponent);
                coursesEditComponent = fixture.componentInstance;
                fixture.detectChanges();
                //spyOn(coursesEditComponent, 'saveToServer');
            });

        //spyOn(coursesEditComponent, 'saveToServer');
        //fixture = TestBed.createComponent(CourseEditComponent);
        //coursesEditComponent = fixture.componentInstance;
        //spyOn(coursesEditComponent, 'saveToServer');
        //fixture.detectChanges();
    });

    it('Should call CoursesService addCourse when new course save', () => {
        var newCourse = new Course({ title: "fromTest", description: 'from test Descr', duration: 100, date: new Date() });
        coursesEditComponent.saveToServer(newCourse);<commit_msg>finished test for courseEdit.component<commit_after>
import { Course } from '../../entities';
import { CourseEditComponent } from './courseEdit.component';
import { CoursesService, AuthorsService, NotificationService, BreadcrumbsService, ApiService } from '../../services';
import { ComponentFixture, TestBed, ComponentFixtureAutoDetect, async } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement, Component } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';

describe('CourseEdit component', () => {
    let fakeCoursesService;
    let coursesEditComponent: CourseEditComponent;
    let fixture: ComponentFixture<CourseEditComponent>;

    let route: ActivatedRoute;
    let router: Router;
    let formBuilder: FormBuilder;
    let authorsService: AuthorsService;
    let notification: NotificationService;
    let breadcrumbsService: BreadcrumbsService;
    let apiService: ApiService

    beforeEach(() => {
        fakeCoursesService = {
            addCourse: jasmine.createSpy(''),
            updateCourse: jasmine.createSpy('')

        };
        //spyOn(fakeCoursesService, 'addCourse');
        //spyOn(fakeCoursesService, 'updateCourse');

        TestBed.configureTestingModule({
            //imports: [Router],
            declarations: [CourseEditComponent],
            providers: [
                { provide: CoursesService, useValue: fakeCoursesService }
            ],
        }).compileComponents()
            .then(() => {
                fixture = TestBed.createComponent(CourseEditComponent);
                coursesEditComponent = fixture.componentInstance;
                fixture.detectChanges();
            });
    });

    it('should have a defined component', () => {
        expect(coursesEditComponent).toBeDefined();
    });

    it('should have a no defined component', () => {
        expect(coursesEditComponent).not.toBeDefined();
    });

    it('Should call CoursesService addCourse when new course save', () => {
        var newCourse = new Course({ title: "fromTest", description: 'from test Descr', duration: 100, date: new Date() });
        coursesEditComponent.saveToServer(newCourse);
{'fraction_non_alphanumeric': 0.11772343648560918, 'fraction_numerical': 0.0012984202553559835, 'mean_word_length': 3.156474820143885, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '131911', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1168, 'n_words': 276}