Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { async, ComponentFixture, TestBed } from '@angular/core/testing';
- import { NO_ERRORS_SCHEMA } from '@angular/core';
- import {FormsModule, ReactiveFormsModule} from '@angular/forms';
- import { MatSnackBarModule, MatInputModule } from '@angular/material';
- import {
- MatFormFieldModule,
- MatSelectModule,
- MatIconModule,
- MatAutocompleteModule,
- MatChipsModule,
- MatListModule
- } from '@angular/material';
- import {CommonModule} from '@angular/common';
- import { MailingTargetService } from '../services/mailing-target.service';
- import { PersonService } from '../services/person.service';
- import { DialogService } from '../services/dialog.service';
- import { MailingTargetComponent } from './mailing-target.component';
- import { PersonComponent } from './person/person.component';
- import {RouterTestingModule} from "@angular/router/testing";
- import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
- import {BehaviorSubject} from "rxjs/BehaviorSubject";
- describe('MailingTargetComponent', () => {
- let component: MailingTargetComponent;
- let fixture: ComponentFixture<MailingTargetComponent>;
- const fakeService = {};
- const mailTargetFakeService = {
- getTargetData$: new BehaviorSubject<any>(null),
- getTargetDetails() {
- this.getBasicSetupData$.next([{
- uuid: 'a60a7a3b-9ca6-4785-92cf-778b17324682',
- contacts: [
- {
- uuid: 'f92edf71-6c98-4057-8578-d958ec1f7424',
- firstname: "John",
- lastname: "Doe",
- email: "jdoe@eqs.com"
- },
- {
- uuid: '7a690a97-9598-4c79-89c7-091e688e490a',
- firstname: "Josh",
- lastname: "L",
- email: "qweqwe@asd.com"
- },
- ],
- lists: [
- {
- uuid: "6a690a97-9598-4c79-89c7-091e688e490d",
- title: "All Developers in Germany",
- number_of_contacts_with_email: 5,
- selected: true
- },
- {
- uuid: "a50a7a3b-9ca6-4785-92cf-778b17324685",
- title: "All Developers in India",
- number_of_contacts_with_email: 3,
- selected: false
- },
- {
- uuid: "3666d5e4-a85a-47ad-9d7b-48e57ac64006",
- title: "HR in India",
- number_of_contacts_with_email: 3,
- selected: false
- }
- ]
- }]);
- },
- getAvailableList() {
- this.getTargetData$.next([{
- uuid: 'a60a7a3b-9ca6-4785-92cf-778b17324682',
- contacts: [
- {
- uuid: 'f92edf71-6c98-4057-8578-d958ec1f7424',
- firstname: "John",
- lastname: "Doe",
- email: "jdoe@eqs.com"
- },
- {
- uuid: '7a690a97-9598-4c79-89c7-091e688e490a',
- firstname: "Josh",
- lastname: "L",
- email: "qweqwe@asd.com"
- },
- ],
- lists: [
- {
- uuid: "6a690a97-9598-4c79-89c7-091e688e490d",
- title: "All Developers in Germany",
- number_of_contacts_with_email: 5,
- selected: true
- },
- {
- uuid: "a50a7a3b-9ca6-4785-92cf-778b17324685",
- title: "All Developers in India",
- number_of_contacts_with_email: 3,
- selected: false
- },
- {
- uuid: "3666d5e4-a85a-47ad-9d7b-48e57ac64006",
- title: "HR in India",
- number_of_contacts_with_email: 3,
- selected: false
- }
- ]
- }]);
- }
- };
- const personFakeService = {
- getUserData$: new BehaviorSubject<any>(null),
- getUserList() {
- this.getUserData$.next([{
- uuid: 'a60a7a3b-9ca6-4785-92cf-778b17324682',
- contacts: [
- {
- uuid: 'f92edf71-6c98-4057-8578-d958ec1f7424',
- firstname: "John",
- lastname: "Doe",
- email: "jdoe@eqs.com"
- },
- {
- uuid: '7a690a97-9598-4c79-89c7-091e688e490a',
- firstname: "Josh",
- lastname: "L",
- email: "qweqwe@asd.com"
- },
- ],
- lists: [
- {
- uuid: "6a690a97-9598-4c79-89c7-091e688e490d",
- title: "All Developers in Germany",
- number_of_contacts_with_email: 5,
- selected: true
- },
- {
- uuid: "a50a7a3b-9ca6-4785-92cf-778b17324685",
- title: "All Developers in India",
- number_of_contacts_with_email: 3,
- selected: false
- },
- {
- uuid: "3666d5e4-a85a-47ad-9d7b-48e57ac64006",
- title: "HR in India",
- number_of_contacts_with_email: 3,
- selected: false
- }
- ]
- }]);
- }
- };
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- imports: [
- CommonModule,
- FormsModule,
- ReactiveFormsModule,
- MatSnackBarModule,
- MatInputModule,
- MatFormFieldModule,
- MatSelectModule,
- MatIconModule,
- MatAutocompleteModule,
- MatChipsModule,
- MatListModule,
- BrowserAnimationsModule,
- RouterTestingModule
- ],
- declarations: [ MailingTargetComponent, PersonComponent ],
- providers: [
- {provide: MailingTargetService, useValue: mailTargetFakeService},
- {provide: PersonService, useValue: personFakeService},
- {provide: DialogService, useValue: fakeService}
- ],
- schemas: [ NO_ERRORS_SCHEMA ]
- })
- .compileComponents();
- }));
- beforeEach(() => {
- fixture = TestBed.createComponent(MailingTargetComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
- it('should create', () => {
- expect(component).toBeTruthy();
- });
- });
Add Comment
Please, Sign In to add comment