Created
February 4, 2017 10:36
-
-
Save qetr1ck-op/a6da1ed5ad345ad2085b06f75edcd528 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import ContactCtrl from './contact.ctrl'; | |
describe('vv.account.contact:ContactCtrl', () => { | |
let sut, accountEnumService, analyticsService; | |
beforeEach(() => { | |
accountEnumService = { | |
slides: { | |
contact: [] | |
}, | |
notifications: { | |
contact: { | |
success: { | |
title: 'title' | |
} | |
} | |
} | |
}; | |
analyticsService = { | |
reportPage: jasmine.createSpy() | |
}; | |
sut = new ContactCtrl(accountEnumService, analyticsService); | |
}); | |
describe('constructor()', () => { | |
it('should set correct props', () => { | |
expect(sut._accountEnumService).toEqual(accountEnumService); | |
expect(sut._analyticsService).toEqual(analyticsService); | |
}); | |
}); | |
describe('$onInit()', () => { | |
it('should set correct props', () => { | |
sut.$onInit(); | |
expect(sut.slides).toEqual(accountEnumService.slides.contact); | |
}); | |
}); | |
describe('onSubmitContact()', () => { | |
const formData = {}; | |
it('should set correct props', () => { | |
sut.onSubmitContact(formData); | |
expect(sut.contactFormData).toBeDefined(); | |
}); | |
}); | |
describe('onSubmitSaleforce()', () => { | |
it('should report page and show successfull notification', () => { | |
sut.onSubmitSaleforce(); | |
expect(sut._analyticsService.reportPage).toHaveBeenCalledWith('contact', 'submitted'); | |
expect(sut.notification).toEqual(sut._accountEnumService.notifications.contact.success); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment