fix test
gitea/salix/2056-entry_descriptor This commit looks good
Details
gitea/salix/2056-entry_descriptor This commit looks good
Details
This commit is contained in:
parent
e7cdc58fad
commit
b37e8da410
|
@ -44,12 +44,6 @@ describe('Client', () => {
|
|||
});
|
||||
|
||||
describe('company setter/getter', () => {
|
||||
it('should return the company', () => {
|
||||
controller.companyId = null;
|
||||
|
||||
expect(controller._companyId).toEqual(jasmine.any(Object));
|
||||
});
|
||||
|
||||
it('should return the company and then call getData()', () => {
|
||||
spyOn(controller, 'getData');
|
||||
controller.companyId = 442;
|
||||
|
|
|
@ -5,7 +5,7 @@ describe('travel getEntry()', () => {
|
|||
it('should check the entry contains the id', async() => {
|
||||
const entry = await app.models.Entry.getEntry(entryId);
|
||||
|
||||
expect(entry.id).toEqual(1);
|
||||
expect(entry.id).toEqual(entryId);
|
||||
});
|
||||
|
||||
it('should check the entry contains the supplier name', async() => {
|
||||
|
|
|
@ -16,10 +16,10 @@ class Controller extends Component {
|
|||
this._entry = value;
|
||||
|
||||
if (value && value.id)
|
||||
this.getEntry();
|
||||
this.getEntryData();
|
||||
}
|
||||
|
||||
getEntry() {
|
||||
getEntryData() {
|
||||
return this.$http.get(`/api/Entries/${this.entry.id}/getEntry`).then(response => {
|
||||
this.entryData = response.data;
|
||||
});
|
||||
|
|
|
@ -18,28 +18,30 @@ describe('component vnEntrySummary', () => {
|
|||
}));
|
||||
|
||||
describe('entry setter/getter', () => {
|
||||
it('should return the entry', () => {
|
||||
it('should check if value.id is defined', () => {
|
||||
spyOn(controller, 'getEntryData');
|
||||
|
||||
controller.entry = {id: 1};
|
||||
|
||||
expect(controller.entry).toEqual(jasmine.any(Object));
|
||||
expect(controller.getEntryData).toHaveBeenCalledWith();
|
||||
});
|
||||
|
||||
it('should return the entry and then call getEntry()', () => {
|
||||
spyOn(controller, 'getEntry');
|
||||
it('should return the entry and then call getEntryData()', () => {
|
||||
spyOn(controller, 'getEntryData');
|
||||
controller.entry = {id: 99};
|
||||
|
||||
expect(controller._entry.id).toEqual(99);
|
||||
expect(controller.getEntry).toHaveBeenCalledWith();
|
||||
expect(controller.getEntryData).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getEntry()', () => {
|
||||
describe('getEntryData()', () => {
|
||||
it('should perform a get and then store data on the controller', () => {
|
||||
controller._entry = {id: 999};
|
||||
|
||||
const query = `/api/Entries/${controller._entry.id}/getEntry`;
|
||||
$httpBackend.expectGET(query).respond('I am the entryData');
|
||||
controller.getEntry();
|
||||
controller.getEntryData();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.entryData).toEqual('I am the entryData');
|
||||
|
|
Loading…
Reference in New Issue