Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should resolve family when displaying it', () => {
const route = fakeSnapshot({ params: {}});
expect(resolver.resolve(route)).toBe(family);
expect(familyService.get).toHaveBeenCalledWith(54);
});
});
it('should retrieve a person and refresh the current person', () => {
const currentPersonService = TestBed.get(CurrentPersonService);
const expectedResult = of({ firstName: 'John', lastName: 'Doe' } as PersonModel);
spyOn(currentPersonService, 'refresh').and.returnValue(expectedResult);
const resolver = TestBed.get(PersonResolverService);
const routeSnapshot = fakeSnapshot({ params: { id: '42' } });
const result = resolver.resolve(routeSnapshot);
expect(result).toBe(expectedResult);
expect(currentPersonService.refresh).toHaveBeenCalledWith(42);
});
});
it('should load when person ID is set on the current route', () => {
const routeSnapshot = fakeSnapshot({
params: {
id: '42'
}
});
const result = resolver.resolve(routeSnapshot);
expect(result).toBe(info);
expect(mockPerUnitRevenueInformationService.get).toHaveBeenCalledWith(42);
});
beforeEach(async(() => {
const member1: NetworkMemberModel = {
id: 42,
type: 'DOCTOR',
text: 'Dr. No'
};
const member2: NetworkMemberModel = {
id: 43,
type: 'LAWYER',
text: 'Dr. Yes'
};
route = fakeRoute({
snapshot: fakeSnapshot({
data: {
members: [ member1, member2 ]
}
})
});
TestBed.configureTestingModule({
declarations: [
PersonNetworkMembersComponent,
DisplayNetworkMemberTypePipe,
ValidationDefaultsComponent,
PageTitleDirective,
FullnamePipe
],
providers: [
{ provide: ActivatedRoute, useValue: route },
},
{
id: 15,
type: { name: 'Electricité'},
monthlyAmount: 50
}
] as Array;
const perUnitRevenueInformation: PerUnitRevenueInformationModel = {
adultLikeCount: 4,
childCount: 2,
monoParental: true
};
const activatedRoute = fakeRoute({
snapshot: fakeSnapshot({
data: {
incomes,
charges,
perUnitRevenueInformation
}
})
});
let tester: PersonResourcesTester;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule, RouterTestingModule, GlobeNgbModule.forRoot()],
declarations: [PersonResourcesComponent, PageTitleDirective, FullnamePipe],
providers: [
{ provide: ActivatedRoute, useValue: activatedRoute },
date: '2001-02-28',
type: 'WEDDING',
location: 'ABROAD'
},
{
id: 43,
date: '2003-03-29',
type: 'DIVORCE',
location: 'FRANCE'
}
];
person = { id: 1, firstName: 'JB', lastName: 'Nizet' } as PersonModel;
route = fakeRoute({
snapshot: fakeSnapshot({data: {events}})
});
const weddingEventService: WeddingEventService =
jasmine.createSpyObj('weddingEventService', ['list', 'create', 'delete']);
const confirmService: ConfirmService =
jasmine.createSpyObj('confirmService', ['confirm']);
TestBed.configureTestingModule({
declarations: [
PersonWeddingEventsComponent,
DisplayWeddingEventTypePipe,
ValidationDefaultsComponent,
DisplayLocationPipe,
PageTitleDirective,
FullnamePipe
],
beforeEach(() => {
participations = [
{
id: 42,
activityType: 'MEAL'
}
];
person = { id: 1, firstName: 'JB', lastName: 'Nizet' } as PersonModel;
route = fakeRoute({
snapshot: fakeSnapshot({data: {participations}})
});
currentPersonService = { snapshot: person } as CurrentPersonService;
});
beforeEach(async(() => {
jasmine.clock().mockDate(DateTime.fromISO('2018-04-30T15:30:00').toJSDate());
person = {
id: 1
} as PersonModel;
memberships = [];
const route = fakeRoute({
snapshot: fakeSnapshot({
data: {
memberships
}
})
});
TestBed.configureTestingModule({
declarations: [
PersonMembershipsComponent,
DisplayPaymentModePipe,
ValidationDefaultsComponent,
PageTitleDirective,
FullnamePipe
],
providers: [
{ provide: ActivatedRoute, useFactory: () => route },
beforeEach(async(() => {
route = fakeRoute({
snapshot: fakeSnapshot({
data: {
}
})
});
TestBed.configureTestingModule({
declarations: [PersonFamilyComponent, SituationComponent, PageTitleDirective, FullnamePipe],
providers: [
FamilyService,
ConfirmService,
{ provide: ActivatedRoute, useFactory: () => route }
],
imports: [
HttpClientTestingModule,
RouterTestingModule,
GlobeNgbModule.forRoot()
beforeEach(async(() => {
profile = {
login: 'joe',
admin: true,
email: 'joe@nowhere.com',
taskAssignmentEmailNotificationEnabled: true
} as ProfileModel;
const route = fakeRoute({
snapshot: fakeSnapshot({
data: { profile }
})
});
TestBed.configureTestingModule({
declarations: [ ProfileComponent ],
imports: [
GlobeNgbModule.forRoot(),
HttpClientTestingModule,
RouterTestingModule,
ReactiveFormsModule,
ValdemortModule
],
providers: [
{ provide: ActivatedRoute, useFactory: () => route }
]