import { TestBed, getTestBed } from '@angular/core/testing';
import {
HttpClientTestingModule,
HttpTestingController
} from '@angular/common/http/testing';
import { MessageBoxService } from './messageBox.service';
import {MessageBoxData} from './messageBox.data';
import { SdcUiCommon} from "onap-ui-angular";
describe('MessageBoxService', () => {
let injector;
let service: MessageBoxService;
let httpMock: HttpTestingController;
beforeAll(done => (async () => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [MessageBoxService]
});
await TestBed.compileComponents();
injector = getTestBed();
service = injector.get(MessageBoxService);
httpMock = injector.get(HttpTestingController);
})().then(done).catch(done.fail));
describe('#setConfig', () => {
test('should return <IModalConfig>', () => {
let title = "Delete Instantiation";
let message = "You are about to stop the instantiation process of this service. \nAll data will be lost. Are you sure you want to stop?";
let messageBoxData : MessageBoxData = new MessageBoxData(
title,
message,
SdcUiCommon.ModalType.warning,
SdcUiCommon.ModalSize.medium,
[
{text:"Stop Instantiation", size:"large", closeModal:true},
{text:"Cancel", size:"medium", closeModal:true}
]);
let result = service.setConfig(messageBoxData);
expect(result.title).toEqual(title);
expect(result.message).toEqual(message);
expect(result.buttons.length).toEqual(2.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.h