blob: 34ad2d738cf07da56c1630a7a9e99d8c7ab39cd3 [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { async } from '@angular/core/testing';
import { ExternalPersonResolver } from '@pages/persons/external-person/external-person.resolver';
describe('ExternalPersonResolver', () => {
let component: ExternalPersonResolver;
let externalPersonSandbox: any;
beforeEach(async(() => {
externalPersonSandbox = {
clear() {},
loadExternalPerson() {},
} as any;
}));
beforeEach(() => {
component = new ExternalPersonResolver(externalPersonSandbox);
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should call loadExternalPerson if edit a external person', () => {
const spy = spyOn(externalPersonSandbox, 'loadExternalPerson');
let ar: any = {params: {contactId: 'ID'}};
component.resolve(ar);
expect(spy).toHaveBeenCalled();
});
it('should call clear if edit a external person', () => {
const spy = spyOn(externalPersonSandbox, 'clear');
let ar: any = {params: {contactId: undefined}};
component.resolve(ar);
expect(spy).toHaveBeenCalled();
});
});