本文整理汇总了TypeScript中app/entities/action-item/action-item.service.ActionItemService类的典型用法代码示例。如果您正苦于以下问题:TypeScript service.ActionItemService类的具体用法?TypeScript service.ActionItemService怎么用?TypeScript service.ActionItemService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了service.ActionItemService类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('ActionItem Service', () => {
let injector: TestBed;
let service: ActionItemService;
let httpMock: HttpTestingController;
let elemDefault: IActionItem;
let currentDate: moment.Moment;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule]
});
injector = getTestBed();
service = injector.get(ActionItemService);
httpMock = injector.get(HttpTestingController);
currentDate = moment();
elemDefault = new ActionItem(
0,
'AAAAAAA',
'AAAAAAA',
'AAAAAAA',
0,
Status.NOT_STARTED,
currentDate,
'AAAAAAA',
0,
currentDate,
currentDate,
'AAAAAAA'
);
});
describe('Service methods', async () => {
it('should find an element', async () => {
const returnedFromService = Object.assign(
{
completedDate: currentDate.format(DATE_FORMAT),
createdDate: currentDate.format(DATE_TIME_FORMAT),
lastModifiedDate: currentDate.format(DATE_TIME_FORMAT)
},
elemDefault
);
service
.find(123)
.pipe(take(1))
.subscribe(resp => expect(resp).toMatchObject({ body: elemDefault }));
const req = httpMock.expectOne({ method: 'GET' });
req.flush(JSON.stringify(returnedFromService));
});
it('should create a ActionItem', async () => {
const returnedFromService = Object.assign(
{
id: 0,
completedDate: currentDate.format(DATE_FORMAT),
createdDate: currentDate.format(DATE_TIME_FORMAT),
lastModifiedDate: currentDate.format(DATE_TIME_FORMAT)
},
elemDefault
);
const expected = Object.assign(
{
completedDate: currentDate,
createdDate: currentDate,
lastModifiedDate: currentDate
},
returnedFromService
);
service
.create(new ActionItem(null))
.pipe(take(1))
.subscribe(resp => expect(resp).toMatchObject({ body: expected }));
const req = httpMock.expectOne({ method: 'POST' });
req.flush(JSON.stringify(returnedFromService));
});
it('should update a ActionItem', async () => {
const returnedFromService = Object.assign(
{
title: 'BBBBBB',
description: 'BBBBBB',
source: 'BBBBBB',
priority: 1,
status: 'BBBBBB',
completedDate: currentDate.format(DATE_FORMAT),
result: 'BBBBBB',
percentComplete: 1,
createdDate: currentDate.format(DATE_TIME_FORMAT),
lastModifiedDate: currentDate.format(DATE_TIME_FORMAT),
trackingNumber: 'BBBBBB'
},
elemDefault
);
const expected = Object.assign(
{
completedDate: currentDate,
createdDate: currentDate,
lastModifiedDate: currentDate
},
//.........这里部分代码省略.........
示例2: it
it('should update a ActionItem', async () => {
const returnedFromService = Object.assign(
{
title: 'BBBBBB',
description: 'BBBBBB',
source: 'BBBBBB',
priority: 1,
status: 'BBBBBB',
completedDate: currentDate.format(DATE_FORMAT),
result: 'BBBBBB',
percentComplete: 1,
createdDate: currentDate.format(DATE_TIME_FORMAT),
lastModifiedDate: currentDate.format(DATE_TIME_FORMAT),
trackingNumber: 'BBBBBB'
},
elemDefault
);
const expected = Object.assign(
{
completedDate: currentDate,
createdDate: currentDate,
lastModifiedDate: currentDate
},
returnedFromService
);
service
.update(expected)
.pipe(take(1))
.subscribe(resp => expect(resp).toMatchObject({ body: expected }));
const req = httpMock.expectOne({ method: 'PUT' });
req.flush(JSON.stringify(returnedFromService));
});