Matteo Scandolo | f083089 | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 1 | 'use strict'; |
Matteo Scandolo | 32f8392 | 2016-02-11 09:35:29 -0800 | [diff] [blame] | 2 | describe('The xos.helper module', function(){ |
Matteo Scandolo | 89b179c | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 3 | var SetCSRFToken, httpProviderObj; |
Matteo Scandolo | f083089 | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 4 | |
Matteo Scandolo | f5ab3ff | 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 | 32f8392 | 2016-02-11 09:35:29 -0800 | [diff] [blame] | 15 | |
Matteo Scandolo | f5ab3ff | 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 | f083089 | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 21 | |
Matteo Scandolo | f5ab3ff | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 22 | inject(function (_SetCSRFToken_) { |
| 23 | SetCSRFToken = _SetCSRFToken_; |
| 24 | }) |
| 25 | }); |
Matteo Scandolo | 89b179c | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 26 | |
| 27 | it('should exist', () => { |
| 28 | expect(SetCSRFToken).toBeDefined(); |
| 29 | }); |
| 30 | |
Matteo Scandolo | f5ab3ff | 2016-03-24 14:07:49 -0700 | [diff] [blame] | 31 | it('should set SetCSRFToken interceptor', () => { |
Matteo Scandolo | 89b179c | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 32 | expect(httpProviderObj).toBeDefined(); |
| 33 | expect(httpProviderObj.interceptors).toContain('SetCSRFToken'); |
| 34 | }); |
| 35 | |
Matteo Scandolo | f083089 | 2015-11-05 11:58:53 +0100 | [diff] [blame] | 36 | }); |