Bri Prebilic Cole | eb28b0b | 2015-01-15 14:20:58 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | ONOS GUI -- Remote -- General Functions - Unit Tests |
| 19 | |
| 20 | @author Bri Prebilic Cole |
| 21 | @author Simon Hunt |
| 22 | */ |
| 23 | describe('factory: fw/remote/urlfn.js', function () { |
| 24 | var $log, $loc, ufs, fs; |
| 25 | |
| 26 | beforeEach(module('onosRemote')); |
| 27 | |
| 28 | beforeEach(module(function($provide) { |
| 29 | $provide.factory('$location', function (){ |
| 30 | return { |
Bri Prebilic Cole | 4fab8af | 2015-01-15 16:40:47 -0800 | [diff] [blame^] | 31 | protocol: function () { return 'http'; }, |
Bri Prebilic Cole | eb28b0b | 2015-01-15 14:20:58 -0800 | [diff] [blame] | 32 | host: function () { return 'foo'; }, |
| 33 | port: function () { return '80'; } |
| 34 | }; |
| 35 | }) |
| 36 | })); |
| 37 | |
| 38 | beforeEach(inject(function (_$log_, $location, UrlFnService, FnService) { |
| 39 | $log = _$log_; |
| 40 | $loc = $location; |
| 41 | ufs = UrlFnService; |
| 42 | fs = FnService; |
| 43 | })); |
| 44 | |
| 45 | it('should define UrlFnService', function () { |
| 46 | expect(ufs).toBeDefined(); |
| 47 | }); |
| 48 | |
| 49 | it('should define api functions', function () { |
| 50 | expect(fs.areFunctions(ufs, [ |
| 51 | 'urlPrefix' |
| 52 | ])).toBeTruthy(); |
| 53 | }); |
| 54 | |
| 55 | it('should build the url prefix', function () { |
Bri Prebilic Cole | 4fab8af | 2015-01-15 16:40:47 -0800 | [diff] [blame^] | 56 | expect(ufs.urlPrefix()).toEqual('http://foo:80'); |
Bri Prebilic Cole | eb28b0b | 2015-01-15 14:20:58 -0800 | [diff] [blame] | 57 | }); |
| 58 | }); |