returnDialog() unit test
This commit is contained in:
parent
22b5e2e8bf
commit
1721509ce4
|
@ -2,14 +2,16 @@ import './billing-data.js';
|
|||
|
||||
describe('Component vnClientBillingData', () => {
|
||||
let $componentController;
|
||||
let $httpBackend;
|
||||
let $scope;
|
||||
|
||||
beforeEach(() => {
|
||||
angular.mock.module('client');
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject(function(_$componentController_, $rootScope) {
|
||||
beforeEach(angular.mock.inject(function(_$componentController_, $rootScope, _$httpBackend_) {
|
||||
$componentController = _$componentController_;
|
||||
$httpBackend = _$httpBackend_;
|
||||
$scope = $rootScope.$new();
|
||||
// should add instanciate of actual watcher instead of submit() spy usage.
|
||||
let submit = jasmine.createSpy('submit').and.returnValue(Promise.resolve());
|
||||
|
@ -66,5 +68,15 @@ describe('Component vnClientBillingData', () => {
|
|||
expect(controller.$.sendMail.show).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('returnDialog()', () => {
|
||||
it('should request to send notification email then show confirmation message', () => {
|
||||
let controller = $componentController('vnClientBillingData', {$scope: $scope});
|
||||
controller.client = {id: '123'};
|
||||
$httpBackend.when('POST', `/mailer/manuscript/${controller.client.id}/payment-update`).respond('done');
|
||||
$httpBackend.expectPOST(`/mailer/manuscript/${controller.client.id}/payment-update`);
|
||||
controller.returnDialog('ACCEPT');
|
||||
$httpBackend.flush();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue