blob: aa3f28ebce97b3721e07c70e85ebcdcac7cf9328 [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
19
20 @author Bri Prebilic Cole
21 @author Simon Hunt
22 */
23describe('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 Cole4fab8af2015-01-15 16:40:47 -080031 protocol: function () { return 'http'; },
Bri Prebilic Coleeb28b0b2015-01-15 14:20:58 -080032 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 Cole4fab8af2015-01-15 16:40:47 -080056 expect(ufs.urlPrefix()).toEqual('http://foo:80');
Bri Prebilic Coleeb28b0b2015-01-15 14:20:58 -080057 });
58});