mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Fixed naming for tests
This commit is contained in:
parent
64331a3350
commit
27003dd4c4
@ -65,7 +65,7 @@ describe('User info component', () => {
|
|||||||
expect(userInfoComp.ecmUserImage).toBeUndefined();
|
expect(userInfoComp.ecmUserImage).toBeUndefined();
|
||||||
expect(userInfoComp.bpmUser).toBeUndefined();
|
expect(userInfoComp.bpmUser).toBeUndefined();
|
||||||
expect(userInfoComp.bpmUserImage).toBeUndefined();
|
expect(userInfoComp.bpmUserImage).toBeUndefined();
|
||||||
expect(userInfoComp.anonymouseImageUrl).not.toBeUndefined();
|
expect(userInfoComp.anonymouseImageUrl).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should NOT have users immediately after ngOnInit', () => {
|
it('should NOT have users immediately after ngOnInit', () => {
|
||||||
@ -74,7 +74,7 @@ describe('User info component', () => {
|
|||||||
expect(userInfoComp.ecmUserImage).toBeUndefined();
|
expect(userInfoComp.ecmUserImage).toBeUndefined();
|
||||||
expect(userInfoComp.bpmUser).toBeUndefined();
|
expect(userInfoComp.bpmUser).toBeUndefined();
|
||||||
expect(userInfoComp.bpmUserImage).toBeUndefined();
|
expect(userInfoComp.bpmUserImage).toBeUndefined();
|
||||||
expect(userInfoComp.anonymouseImageUrl).not.toBeUndefined();
|
expect(userInfoComp.anonymouseImageUrl).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when user is logged on ecm', () => {
|
describe('when user is logged on ecm', () => {
|
||||||
@ -92,19 +92,19 @@ describe('User info component', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should get the ecm current user image from the service', () => {
|
it('should get the ecm current user image from the service', () => {
|
||||||
expect(userInfoComp.ecmUser).not.toBeUndefined();
|
expect(userInfoComp.ecmUser).toBeDefined();
|
||||||
expect(userInfoComp.ecmUserImage).not.toBeUndefined();
|
expect(userInfoComp.ecmUserImage).toBeDefined();
|
||||||
expect(userInfoComp.ecmUserImage).toEqual('fake/url/image/for/ecm/user');
|
expect(userInfoComp.ecmUserImage).toEqual('fake/url/image/for/ecm/user');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get the ecm user informations from the service', () => {
|
it('should get the ecm user informations from the service', () => {
|
||||||
expect(userInfoComp.ecmUser).not.toBeUndefined();
|
expect(userInfoComp.ecmUser).toBeDefined();
|
||||||
expect(userInfoComp.ecmUser.firstName).toEqual('fake-first-name');
|
expect(userInfoComp.ecmUser.firstName).toEqual('fake-first-name');
|
||||||
expect(userInfoComp.ecmUser.lastName).toEqual('fake-last-name');
|
expect(userInfoComp.ecmUser.lastName).toEqual('fake-last-name');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the anonynous user avatar image url when user does not have avatarId', async(() => {
|
it('should return the anonynous user avatar image url when user does not have avatarId', async(() => {
|
||||||
fakeEcmService.userNeeded = 1;
|
fakeEcmService.respondWithTheUserWithoutImage();
|
||||||
userInfoComp.ngOnInit();
|
userInfoComp.ngOnInit();
|
||||||
fixture.whenStable()
|
fixture.whenStable()
|
||||||
.then( () => {
|
.then( () => {
|
||||||
@ -131,19 +131,19 @@ describe('User info component', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should get the bpm current user image from the service', () => {
|
it('should get the bpm current user image from the service', () => {
|
||||||
expect(userInfoComp.bpmUser).not.toBeUndefined();
|
expect(userInfoComp.bpmUser).toBeDefined();
|
||||||
expect(userInfoComp.bpmUserImage).not.toBeUndefined();
|
expect(userInfoComp.bpmUserImage).toBeDefined();
|
||||||
expect(userInfoComp.bpmUserImage).toEqual('fake-picture-id');
|
expect(userInfoComp.bpmUserImage).toEqual('fake-picture-id');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get the bpm user informations from the service', () => {
|
it('should get the bpm user informations from the service', () => {
|
||||||
expect(userInfoComp.bpmUser).not.toBeUndefined();
|
expect(userInfoComp.bpmUser).toBeDefined();
|
||||||
expect(userInfoComp.bpmUser.firstName).toEqual('fake-first-name');
|
expect(userInfoComp.bpmUser.firstName).toEqual('fake-first-name');
|
||||||
expect(userInfoComp.bpmUser.lastName).toEqual('fake-last-name');
|
expect(userInfoComp.bpmUser.lastName).toEqual('fake-last-name');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the anonynous user avatar image url when user does not have avatarId', async(() => {
|
it('should return the anonynous user avatar image url when user does not have avatarId', async(() => {
|
||||||
fakeBpmService.userNeeded = 1;
|
fakeBpmService.respondWithTheUserWithoutImage();
|
||||||
userInfoComp.ngOnInit();
|
userInfoComp.ngOnInit();
|
||||||
fixture.whenStable()
|
fixture.whenStable()
|
||||||
.then( () => {
|
.then( () => {
|
||||||
@ -172,26 +172,26 @@ describe('User info component', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should get the bpm current user image from the service', () => {
|
it('should get the bpm current user image from the service', () => {
|
||||||
expect(userInfoComp.bpmUser).not.toBeUndefined();
|
expect(userInfoComp.bpmUser).toBeDefined();
|
||||||
expect(userInfoComp.bpmUserImage).not.toBeUndefined();
|
expect(userInfoComp.bpmUserImage).toBeDefined();
|
||||||
expect(userInfoComp.bpmUserImage).toEqual('fake-picture-id');
|
expect(userInfoComp.bpmUserImage).toEqual('fake-picture-id');
|
||||||
expect(userInfoComp.ecmUser).not.toBeUndefined();
|
expect(userInfoComp.ecmUser).toBeDefined();
|
||||||
expect(userInfoComp.ecmUserImage).not.toBeUndefined();
|
expect(userInfoComp.ecmUserImage).toBeDefined();
|
||||||
expect(userInfoComp.ecmUserImage).toEqual('fake/url/image/for/ecm/user');
|
expect(userInfoComp.ecmUserImage).toEqual('fake/url/image/for/ecm/user');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get the bpm user informations from the service', () => {
|
it('should get the bpm user informations from the service', () => {
|
||||||
expect(userInfoComp.bpmUser).not.toBeUndefined();
|
expect(userInfoComp.bpmUser).toBeDefined();
|
||||||
expect(userInfoComp.bpmUser.firstName).toEqual('fake-first-name');
|
expect(userInfoComp.bpmUser.firstName).toEqual('fake-first-name');
|
||||||
expect(userInfoComp.bpmUser.lastName).toEqual('fake-last-name');
|
expect(userInfoComp.bpmUser.lastName).toEqual('fake-last-name');
|
||||||
expect(userInfoComp.ecmUser).not.toBeUndefined();
|
expect(userInfoComp.ecmUser).toBeDefined();
|
||||||
expect(userInfoComp.ecmUser.firstName).toEqual('fake-first-name');
|
expect(userInfoComp.ecmUser.firstName).toEqual('fake-first-name');
|
||||||
expect(userInfoComp.ecmUser.lastName).toEqual('fake-last-name');
|
expect(userInfoComp.ecmUser.lastName).toEqual('fake-last-name');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the anonynous user avatar image url when user does not have avatarId', async(() => {
|
it('should return the anonynous user avatar image url when user does not have avatarId', async(() => {
|
||||||
fakeBpmService.userNeeded = 1;
|
fakeBpmService.respondWithTheUserWithoutImage();
|
||||||
fakeEcmService.userNeeded = 1;
|
fakeEcmService.respondWithTheUserWithoutImage();
|
||||||
userInfoComp.ngOnInit();
|
userInfoComp.ngOnInit();
|
||||||
fixture.whenStable()
|
fixture.whenStable()
|
||||||
.then( () => {
|
.then( () => {
|
||||||
@ -206,36 +206,36 @@ describe('User info component', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should return the ecm image if exists', async(() => {
|
it('should return the ecm image if exists', async(() => {
|
||||||
fakeBpmService.userNeeded = 0;
|
fakeBpmService.respondWithTheUserWithImage();
|
||||||
fakeEcmService.userNeeded = 0;
|
fakeEcmService.respondWithTheUserWithImage();
|
||||||
userInfoComp.ngOnInit();
|
userInfoComp.ngOnInit();
|
||||||
fixture.whenStable()
|
fixture.whenStable()
|
||||||
.then( () => {
|
.then( () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
let res = userInfoComp.getUserAvatar();
|
let res = userInfoComp.getUserAvatar();
|
||||||
expect(userInfoComp.bpmUserImage).not.toBeUndefined();
|
expect(userInfoComp.bpmUserImage).toBeDefined();
|
||||||
expect(userInfoComp.ecmUserImage).not.toBeUndefined();
|
expect(userInfoComp.ecmUserImage).toBeDefined();
|
||||||
expect(res).toEqual(userInfoComp.ecmUserImage);
|
expect(res).toEqual(userInfoComp.ecmUserImage);
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should return the bpm image if ecm does not have it', async(() => {
|
it('should return the bpm image if ecm does not have it', async(() => {
|
||||||
fakeBpmService.userNeeded = 0;
|
fakeBpmService.respondWithTheUserWithImage();
|
||||||
fakeEcmService.userNeeded = 1;
|
fakeEcmService.respondWithTheUserWithoutImage();
|
||||||
userInfoComp.ngOnInit();
|
userInfoComp.ngOnInit();
|
||||||
fixture.whenStable()
|
fixture.whenStable()
|
||||||
.then( () => {
|
.then( () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
let res = userInfoComp.getUserAvatar();
|
let res = userInfoComp.getUserAvatar();
|
||||||
expect(userInfoComp.bpmUserImage).not.toBeUndefined();
|
expect(userInfoComp.bpmUserImage).toBeDefined();
|
||||||
expect(userInfoComp.ecmUserImage).toBeUndefined();
|
expect(userInfoComp.ecmUserImage).toBeUndefined();
|
||||||
expect(res).toEqual(userInfoComp.bpmUserImage);
|
expect(res).toEqual(userInfoComp.bpmUserImage);
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should return the anonynous avatar if no user has it', async(() => {
|
it('should return the anonynous avatar if no user has it', async(() => {
|
||||||
fakeBpmService.userNeeded = 1;
|
fakeBpmService.respondWithTheUserWithoutImage();
|
||||||
fakeEcmService.userNeeded = 1;
|
fakeEcmService.respondWithTheUserWithoutImage();
|
||||||
userInfoComp.ngOnInit();
|
userInfoComp.ngOnInit();
|
||||||
fixture.whenStable()
|
fixture.whenStable()
|
||||||
.then( () => {
|
.then( () => {
|
||||||
|
@ -93,7 +93,7 @@ describe('Bpm User service', () => {
|
|||||||
spyOn(service, 'callApiGetProfile').and.returnValue(Promise.resolve(fakeBpmUser));
|
spyOn(service, 'callApiGetProfile').and.returnValue(Promise.resolve(fakeBpmUser));
|
||||||
service.getCurrentUserInfo().subscribe(
|
service.getCurrentUserInfo().subscribe(
|
||||||
(user) => {
|
(user) => {
|
||||||
expect(user).not.toBeUndefined();
|
expect(user).toBeDefined();
|
||||||
expect(user.firstName).toEqual('fake-first-name');
|
expect(user.firstName).toEqual('fake-first-name');
|
||||||
expect(user.lastName).toEqual('fake-last-name');
|
expect(user.lastName).toEqual('fake-last-name');
|
||||||
expect(user.email).toEqual('fakeBpm@fake.com');
|
expect(user.email).toEqual('fakeBpm@fake.com');
|
||||||
@ -111,7 +111,7 @@ describe('Bpm User service', () => {
|
|||||||
spyOn(service, 'callApiGetProfilePicture').and.returnValue(Promise.resolve('fake/img/path'));
|
spyOn(service, 'callApiGetProfilePicture').and.returnValue(Promise.resolve('fake/img/path'));
|
||||||
service.getCurrentUserProfileImage().subscribe(
|
service.getCurrentUserProfileImage().subscribe(
|
||||||
(path) => {
|
(path) => {
|
||||||
expect(path).not.toBeUndefined();
|
expect(path).toBeDefined();
|
||||||
expect(path).toEqual('fake/img/path');
|
expect(path).toEqual('fake/img/path');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -28,7 +28,7 @@ export var fakeEcmCompany: EcmCompanyModel = {
|
|||||||
address3: 'fake-address-3',
|
address3: 'fake-address-3',
|
||||||
postcode: 'fAk1',
|
postcode: 'fAk1',
|
||||||
telephone: '00000000',
|
telephone: '00000000',
|
||||||
fax: '11111111',
|
fax: '=1111111',
|
||||||
email: 'fakeCompany@fake.com'
|
email: 'fakeCompany@fake.com'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ describe('Ecm User service', () => {
|
|||||||
spyOn(service, 'callApiGetPersonInfo').and.returnValue(Promise.resolve(userJsApiResponse));
|
spyOn(service, 'callApiGetPersonInfo').and.returnValue(Promise.resolve(userJsApiResponse));
|
||||||
service.getCurrentUserInfo().subscribe(
|
service.getCurrentUserInfo().subscribe(
|
||||||
(user) => {
|
(user) => {
|
||||||
expect(user).not.toBeUndefined();
|
expect(user).toBeDefined();
|
||||||
expect(user.firstName).toEqual('fake-first-name');
|
expect(user.firstName).toEqual('fake-first-name');
|
||||||
expect(user.lastName).toEqual('fake-last-name');
|
expect(user.lastName).toEqual('fake-last-name');
|
||||||
expect(user.email).toEqual('fakeEcm@ecmUser.com');
|
expect(user.email).toEqual('fakeEcm@ecmUser.com');
|
||||||
@ -150,7 +150,7 @@ describe('Ecm User service', () => {
|
|||||||
it('should build the body for the content service', () => {
|
it('should build the body for the content service', () => {
|
||||||
spyOn(contentServiceForTest, 'getContentUrl').and.callThrough();
|
spyOn(contentServiceForTest, 'getContentUrl').and.callThrough();
|
||||||
let urlRs = service.getCurrentUserProfileImageUrl('fake-avatar-id');
|
let urlRs = service.getCurrentUserProfileImageUrl('fake-avatar-id');
|
||||||
expect(urlRs).not.toBeUndefined();
|
expect(urlRs).toBeDefined();
|
||||||
expect(contentServiceForTest.getContentUrl).toHaveBeenCalledWith( {entry: {id: 'fake-avatar-id'} });
|
expect(contentServiceForTest.getContentUrl).toHaveBeenCalledWith( {entry: {id: 'fake-avatar-id'} });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -86,4 +86,13 @@ export class FakeBpmUserService {
|
|||||||
return this.usersList[this.userNeeded].pictureId;
|
return this.usersList[this.userNeeded].pictureId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
respondWithTheUserWithoutImage() {
|
||||||
|
this.userNeeded = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
respondWithTheUserWithImage() {
|
||||||
|
this.userNeeded = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -96,4 +96,12 @@ export class FakeEcmUserService {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
respondWithTheUserWithoutImage() {
|
||||||
|
this.userNeeded = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
respondWithTheUserWithImage() {
|
||||||
|
this.userNeeded = 0;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user