Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 1 | 'use strict'; |
Matteo Scandolo | ba4c9aa | 2016-02-11 09:35:29 -0800 | [diff] [blame] | 2 | describe('The xos.helper module', function(){ |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 3 | var SetCSRFToken, httpProviderObj; |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 4 | |
Matteo Scandolo | 061094b | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 5 | //beforeEach(module('xos.helpers')); |
| 6 | // |
| 7 | //beforeEach(inject(function($httpProvider){ |
| 8 | // httpProviderObj = $httpProvider; |
| 9 | //})); |
| 10 | // |
| 11 | //beforeEach(inject(function(_SetCSRFToken_){ |
| 12 | // console.log('inject csrf'); |
| 13 | // SetCSRFToken = _SetCSRFToken_; |
| 14 | //})); |
Matteo Scandolo | ba4c9aa | 2016-02-11 09:35:29 -0800 | [diff] [blame] | 15 | |
Matteo Scandolo | 061094b | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 16 | beforeEach(function() { |
| 17 | module('xos.helpers', function ($httpProvider) { |
| 18 | //save our interceptor |
| 19 | httpProviderObj = $httpProvider; |
| 20 | }); |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 21 | |
Matteo Scandolo | 061094b | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 22 | inject(function (_SetCSRFToken_) { |
| 23 | SetCSRFToken = _SetCSRFToken_; |
| 24 | }) |
| 25 | }); |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 26 | |
| 27 | it('should exist', () => { |
| 28 | expect(SetCSRFToken).toBeDefined(); |
| 29 | }); |
| 30 | |
Matteo Scandolo | 061094b | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 31 | it('should set SetCSRFToken interceptor', () => { |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 32 | expect(httpProviderObj).toBeDefined(); |
| 33 | expect(httpProviderObj.interceptors).toContain('SetCSRFToken'); |
| 34 | }); |
| 35 | |
Matteo Scandolo | 57483dd | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 36 | }); |