Last active
September 22, 2017 19:54
-
-
Save yury-sannikov/c958cc0502afff220b8da0964095f73d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@testMethod('checkSeatings should return rejected promise on error') | |
@inject(null, 'error') | |
@testMethod('checkSeatings should return rejected promise if seats and capacity doesnt match') | |
@inject({sections: [{seats: 1}], ticketQuantityAvailable: 5}, null) | |
@inject({sections: [{seats: 1}, {seats: 2}], ticketQuantityAvailable: 5}, null) | |
@testMethod('checkSeatings should return resolved promise') | |
@inject({sections: [{seats: 1}, {seats: 2}, {seats: 2}], ticketQuantityAvailable: 5}, null) | |
checkSeatings(result, error, done) { | |
const getSections = apexCallFactory(error ? apexErrorResult(error) : apexSuccessResult(result)); | |
const component = componentFactory({ | |
getSections, eventId: 10, | |
findMap: {toastMessages: 'Framework:Toast'} | |
}); | |
helper.checkSeatings(component).then(() => { | |
expect(component.find('toastMessages').showMessage).not.to.have.been.called; | |
done(); | |
}).catch((msg) => { | |
if (error) { | |
expect(component.find('toastMessages').showMessage).to.have.been.called; | |
} else { | |
expect(component.find('toastMessages').showMessage).not.to.have.been.called; | |
expect(msg).to.equal($A.get('$Label.c.Event_Builder_Seating_Ticket_Capacity_Doesnt_Match')); | |
} | |
done(); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment