blob: cf41a139d402ab0598aeb5d02b1431b8c15d5115 [file] [log] [blame]
Bri Prebilic Coleeb28b0b2015-01-15 14:20:58 -08001/*
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
Bri Prebilic Coleeb28b0b2015-01-15 14:20:58 -080019 */
20describe('factory: fw/remote/urlfn.js', function () {
21 var $log, $loc, ufs, fs;
22
23 beforeEach(module('onosRemote'));
24
25 beforeEach(module(function($provide) {
26 $provide.factory('$location', function (){
27 return {
Bri Prebilic Cole4fab8af2015-01-15 16:40:47 -080028 protocol: function () { return 'http'; },
Bri Prebilic Coleeb28b0b2015-01-15 14:20:58 -080029 host: function () { return 'foo'; },
30 port: function () { return '80'; }
31 };
32 })
33 }));
34
35 beforeEach(inject(function (_$log_, $location, UrlFnService, FnService) {
36 $log = _$log_;
37 $loc = $location;
38 ufs = UrlFnService;
39 fs = FnService;
40 }));
41
42 it('should define UrlFnService', function () {
43 expect(ufs).toBeDefined();
44 });
45
46 it('should define api functions', function () {
47 expect(fs.areFunctions(ufs, [
48 'urlPrefix'
49 ])).toBeTruthy();
50 });
51
52 it('should build the url prefix', function () {
Bri Prebilic Cole4fab8af2015-01-15 16:40:47 -080053 expect(ufs.urlPrefix()).toEqual('http://foo:80');
Bri Prebilic Coleeb28b0b2015-01-15 14:20:58 -080054 });
55});