cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [01/16] git commit: begin firefoxos tests
Date Wed, 16 Oct 2013 22:52:54 GMT
Updated Branches:
  refs/heads/master 048645825 -> 7c74aa5a1


begin firefoxos tests


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/005a3d11
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/005a3d11
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/005a3d11

Branch: refs/heads/master
Commit: 005a3d11ac26b06bfeabc6b4b49d1446193b71b7
Parents: 9b5f464
Author: James Long <longster@gmail.com>
Authored: Thu Oct 10 15:03:37 2013 -0400
Committer: James Long <longster@gmail.com>
Committed: Thu Oct 10 15:03:37 2013 -0400

----------------------------------------------------------------------
 spec/metadata/firefoxos_parser.spec.js | 98 +++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/005a3d11/spec/metadata/firefoxos_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/firefoxos_parser.spec.js b/spec/metadata/firefoxos_parser.spec.js
new file mode 100644
index 0000000..e6bc786
--- /dev/null
+++ b/spec/metadata/firefoxos_parser.spec.js
@@ -0,0 +1,98 @@
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+var platforms = require('../../platforms'),
+    util = require('../../src/util'),
+    path = require('path'),
+    shell = require('shelljs'),
+    fs = require('fs'),
+    ET = require('elementtree'),
+    config = require('../../src/config'),
+    config_parser = require('../../src/config_parser'),
+    cordova = require('../../cordova');
+
+describe('firefoxos project parser', function() {
+    var proj = path.join('some', 'path');
+    var exists, exec, custom, cfg_parser;
+    beforeEach(function() {
+        exists = spyOn(fs, 'existsSync').andReturn(true);
+        exec = spyOn(shell, 'exec').andCallFake(function(cmd, opts, cb) {
+            cb(0, '');
+        });
+        custom = spyOn(config, 'has_custom_path').andReturn(false);
+        cfg_parser = spyOn(util, 'config_parser');
+    });
+
+    describe('constructions', function() {
+        it('should create an instance with a path', function() {
+            expect(function() {
+                var p = new platforms.android.parser(proj);
+                expect(p.path).toEqual(proj);
+            }).not.toThrow();
+        });
+    });
+
+    describe('instance', function() {
+        var p, cp, rm, is_cordova, write, read;
+        var ff_proj = path.join(proj, 'platforms', 'firefoxos');
+        beforeEach(function() {
+            p = new platforms.firefoxos.parser(ff_proj);
+            cp = spyOn(shell, 'cp');
+            rm = spyOn(shell, 'rm');
+            is_cordova = spyOn(util, 'isCordova').andReturn(proj);
+            write = spyOn(fs, 'writeFileSync');
+            read = spyOn(fs, 'readFileSync').andReturn('');
+        });
+
+        describe('update_from_config method', function() {
+            var cfg, cfg_access_add, cfg_access_rm,
+                cfg_pref_rm, cfg_pref_add, cfg_content;
+
+            beforeEach(function() {
+                cfg = new config_parser();
+                cfg.name = function() { return 'testname'; };
+                cfg.packageName = function() { return 'testpkg'; };
+                cfg.version = function() { return '1.0'; };
+
+                cfg_access_add = jasmine.createSpy('config_parser access add');
+                cfg_access_rm = jasmine.createSpy('config_parser access rm');
+                cfg_pref_rm = jasmine.createSpy('config_parser pref rm');
+                cfg_pref_add = jasmine.createSpy('config_parser pref add');
+                cfg_content = jasmine.createSpy('config_parser content');
+                cfg_parser = spyOn(util, 'config_parser').andReturn({
+                    access:{
+                        remove:cfg_access_rm,
+                        get:function(){},
+                        add:cfg_access_add
+                    },
+                    preference:{
+                        remove:cfg_pref_rm,
+                        get:function(){},
+                        add:cfg_pref_add
+                    },
+                    content:cfg_content
+                });
+            });
+
+            it('should write manifest.webapp', function() {
+                //p.update_from_config(cfg);
+                //expect(write.mostRecentCall.args[0]).toEqual('manifest.webapp');
+            });
+        });
+    });
+});


Mime
View raw message