Rename the statements for correctly description the action
This commit is contained in:
parent
6e08a66343
commit
d09e47835e
|
@ -45,7 +45,7 @@ describe('vnItemBotanical', () => {
|
|||
expect(controller.$.genus.show).not.toHaveBeenCalledWith();
|
||||
});
|
||||
|
||||
it('should call preventDefault() and show() in genus field when the default is not prevented', () => {
|
||||
it('should call show function in genus field when the default is not prevented', () => {
|
||||
const event = {
|
||||
defaultPrevented: false,
|
||||
preventDefault: () => {}
|
||||
|
@ -76,7 +76,7 @@ describe('vnItemBotanical', () => {
|
|||
expect(controller.$.species.show).not.toHaveBeenCalledWith();
|
||||
});
|
||||
|
||||
it('should call preventDefault() and show() in species field when the default is not prevented', () => {
|
||||
it('should call show function in species field when the default is not prevented', () => {
|
||||
const event = {
|
||||
defaultPrevented: false,
|
||||
preventDefault: () => {}
|
||||
|
@ -93,7 +93,7 @@ describe('vnItemBotanical', () => {
|
|||
});
|
||||
|
||||
describe('onGenusAccept()', () => {
|
||||
it('should throw an error if there is no name in the genus name field', () => {
|
||||
it('should throw an error if genus field has not name', () => {
|
||||
jest.spyOn(controller.vnApp, 'showMessage');
|
||||
|
||||
controller.data = {};
|
||||
|
@ -104,10 +104,12 @@ describe('vnItemBotanical', () => {
|
|||
});
|
||||
|
||||
it('should do add the new genus', () => {
|
||||
$httpBackend.whenRoute('GET', 'ItemBotanicals').respond({});
|
||||
const response = {data: 'MyResult'};
|
||||
$httpBackend.whenRoute('GET', 'ItemBotanicals').respond(response);
|
||||
$httpBackend.resetExpectations();
|
||||
|
||||
controller.data = {
|
||||
id: 4,
|
||||
name: 'Anilius'
|
||||
};
|
||||
|
||||
|
@ -115,25 +117,28 @@ describe('vnItemBotanical', () => {
|
|||
|
||||
controller.onGenusAccept();
|
||||
$httpBackend.flush();
|
||||
controller.onGenusResponse(controller.data.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe('onSpeciesAccept()', () => {
|
||||
it('should throw an error if there is no name in the specie name field', () => {
|
||||
it('should throw an error if species field has not name', () => {
|
||||
jest.spyOn(controller.vnApp, 'showMessage');
|
||||
|
||||
controller.data = {};
|
||||
|
||||
controller.onSpeciesAccept();
|
||||
|
||||
expect(controller.vnApp.showError).toHaveBeenCalledWith(`The name of the specie can't be empty`);
|
||||
expect(controller.vnApp.showError).toHaveBeenCalledWith(`The name of the species can't be empty`);
|
||||
});
|
||||
|
||||
it('should do add the new specie', () => {
|
||||
$httpBackend.whenRoute('GET', 'ItemBotanicals').respond({});
|
||||
it('should do add the new species', () => {
|
||||
const response = {data: 'MyResult'};
|
||||
$httpBackend.whenRoute('GET', 'ItemBotanicals').respond(response);
|
||||
$httpBackend.resetExpectations();
|
||||
|
||||
controller.data = {
|
||||
id: 2,
|
||||
name: 'Spasiva'
|
||||
};
|
||||
|
||||
|
@ -141,12 +146,14 @@ describe('vnItemBotanical', () => {
|
|||
|
||||
controller.onSpeciesAccept();
|
||||
$httpBackend.flush();
|
||||
controller.onSpeciesResponse(controller.data.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe('onSubmit()', () => {
|
||||
it('should make an HTTP POST request to save the genus and species data', () => {
|
||||
$httpBackend.whenRoute('GET', 'ItemBotanicals').respond({});
|
||||
it('should make HTTP POST request to save the genus and species data', () => {
|
||||
const response = {data: 'MyResult'};
|
||||
$httpBackend.whenRoute('GET', 'ItemBotanicals').respond(response);
|
||||
$httpBackend.resetExpectations();
|
||||
|
||||
jest.spyOn(controller.$.watcher, 'updateOriginalData');
|
||||
|
@ -154,7 +161,7 @@ describe('vnItemBotanical', () => {
|
|||
jest.spyOn(controller.$.watcher, 'notifySaved');
|
||||
|
||||
controller.botanical = [{itemFk: 5, genusFk: 3, specieFk: 2}];
|
||||
$httpBackend.expectPATCH('ItemBotanicals', controller.botanical).respond({});
|
||||
$httpBackend.expectPATCH('ItemBotanicals', controller.botanical).respond();
|
||||
controller.onSubmit();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
@ -165,7 +172,7 @@ describe('vnItemBotanical', () => {
|
|||
});
|
||||
|
||||
describe('getBotanicalData()', () => {
|
||||
it('should get the item data from itemBotanical', () => {
|
||||
it('should get the species and genus data references of the item', () => {
|
||||
const response = ['MyResult'];
|
||||
$httpBackend.whenRoute('GET', `ItemBotanicals`).respond(response);
|
||||
controller.getBotanicalData();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
The genus has been created: El genus ha sido creado
|
||||
The specie has been created: La especie ha sido creada
|
||||
The species has been created: La especie ha sido creada
|
||||
Latin species name: Nombre de la especie en latín
|
||||
Latin genus name: Nombre del genus en latín
|
||||
Species: Especie
|
Loading…
Reference in New Issue