it('should save/exec named sync', function () { var name = 'sync-op', result = perfy.exec(name, function () { var i = 0; while (i < 10000) { i += 1; } }); expect(result).toBeDefined(); expect(result.time).toEqual(jasmine.any(Number)); expect(perfy.result(name)).toBeDefined(); expect(perfy.exists(name)).toEqual(true); });
it('should exec async', function (jasmineDone) { perfy.destroyAll().exec(function (done) { setTimeout(function () { var result = done(); expect(result).toBeDefined(); expect(result.time).toBeGreaterThan(1); expect(result.name).toEqual(''); expect(perfy.count()).toEqual(0); jasmineDone(); }, 1100); }); });
describe('latestTick', function() { it('should be stored when the response of the first TIME request is received', function() { var data = new Buffer([0xb, 0x84, 0x78, 0xe5, 0xc9, 0x5e, 0x4]); log.downloadLog(); device.emitter.emit([MODULE, TIME], data, MODULE.toString(16), TIME.toString(16)); expect(log.latestTick.tick).toBeDefined(); expect(log.latestTick.tick).toEqual(1590289784); }); it('should handle value coded on less than 4 bytes', function() { var data = new Buffer([0xb, 0x84, 0x78, 0xe5, 0xc9, 0x5e, 0x4]); }); });
it('Test 035 : should merge singleton name without clobber', function () { const testXml = et.XML('<widget><name>SUPER_NAME</name></widget>'); xml_helpers.mergeXml(testXml, dstXml); const testElements = dstXml.findall('name'); expect(testElements).toBeDefined(); expect(testElements.length).toEqual(1); expect(testElements[0].text).toContain('Hello Cordova'); });
it('Test 041 : should have getByDensity method returning resource with density specified or null', function () { expect(cfg.getStaticResources('android', 'icon').getByDensity('hdpi')).toBe(null); expect(cfg.getStaticResources('android', 'icon').getByDensity('mdpi')).toBeDefined(); expect(cfg.getStaticResources('android', 'icon').getByDensity('mdpi').src).toBe('logo-android.png'); });
it('Test 031 : should handle attributes values with quotes correctly', function () { const testXml = et.XML('<widget><quote foo="some \'quoted\' string" bar="another "quoted" string" baz=""mixed" \'quotes\'" /></widget>'); xml_helpers.mergeXml(testXml, dstXml); expect(dstXml.find('quote')).toBeDefined(); expect(dstXml.find('quote').attrib.foo).toEqual('some \'quoted\' string'); expect(dstXml.find('quote').attrib.bar).toEqual('another "quoted" string'); expect(dstXml.find('quote').attrib.baz).toEqual('"mixed" \'quotes\''); });
describe('Testable', function () { it("should pass a test", function() { expect(window).toBeDefined(); }); it("should exist", function() { expect(window.testable).toBeDefined(); }); it("should be self aware",function() { expect(window.testable.doYouExist).toEqual("fuckYeah"); }) });
it('Test 012 : should create munges for platform-agnostic config.xml changes', function () { const munger = new configChanges.PlatformMunger('android', temp, 'unused', null, pluginInfoProvider); const munge = munger.generate_plugin_config_munge(pluginInfoProvider.get(dummyplugin), {}); expect(get_munge_change(munge, 'config.xml', '/*', '<access origin="build.phonegap.com" />')).toBeDefined(); expect(get_munge_change(munge, 'config.xml', '/*', '<access origin="s3.amazonaws.com" />')).toBeDefined(); });
it('Test 033 : should merge platform tags with the correct platform', function () { const testXml = et.XML('<widget><platform name="bar"><testElement testAttrib="value">testTEXT</testElement></platform></widget>'); const origCfg = et.tostring(dstXml); xml_helpers.mergeXml(testXml, dstXml, 'bar', true); expect(et.tostring(dstXml)).not.toEqual(origCfg); const testElement = dstXml.find('testElement'); expect(testElement).toBeDefined(); expect(testElement.attrib.testAttrib).toEqual('value'); expect(testElement.text).toEqual('testTEXT'); });
it('Test 028 : should be able to read legacy feature entries with a url', function () { const plugin = cfg.getPlugin('org.apache.cordova.legacyfeatureurl'); expect(plugin).toBeDefined(); expect(plugin.name).toEqual('org.apache.cordova.legacyfeatureurl'); expect(plugin.spec).toEqual('http://cordova.apache.org/legacyfeatureurl'); });
it('Test 034 : should merge singleton children without clobber', function () { const testXml = et.XML('<widget><author testAttrib="value" href="http://www.nowhere.com">SUPER_AUTHOR</author></widget>'); xml_helpers.mergeXml(testXml, dstXml); const testElements = dstXml.findall('author'); expect(testElements).toBeDefined(); expect(testElements.length).toEqual(1); expect(testElements[0].attrib.testAttrib).toEqual('value'); expect(testElements[0].attrib.href).toEqual('http://cordova.io'); expect(testElements[0].attrib.email).toEqual('dev@cordova.apache.org'); expect(testElements[0].text).toContain('Apache Cordova Team'); });
it('Test 001 : should create an instance based on an xml file', function () { let cfg; expect(function () { cfg = new ConfigParser(xml); }).not.toThrow(); expect(cfg).toBeDefined(); expect(cfg.doc).toBeDefined(); });
it('Test 024 : should read plugin variables', function () { const plugin = cfg.getPlugin('org.apache.cordova.pluginwithvars'); expect(plugin.variables).toBeDefined(); expect(plugin.variables.var).toBeDefined(); expect(plugin.variables.var).toEqual('varvalue'); });
it('Test 019 : should read plugin given id', function () { const plugin = cfg.getPlugin('org.apache.cordova.justaplugin'); expect(plugin).toBeDefined(); expect(plugin.name).toEqual('org.apache.cordova.justaplugin'); expect(plugin.variables).toBeDefined(); });
it('Test 036 : should clobber singleton children with clobber', function () { const testXml = et.XML('<widget><author testAttrib="value" href="http://www.nowhere.com">SUPER_AUTHOR</author></widget>'); xml_helpers.mergeXml(testXml, dstXml, '', true); const testElements = dstXml.findall('author'); expect(testElements).toBeDefined(); expect(testElements.length).toEqual(1); expect(testElements[0].attrib.testAttrib).toEqual('value'); expect(testElements[0].attrib.href).toEqual('http://www.nowhere.com'); expect(testElements[0].attrib.email).toEqual('dev@cordova.apache.org'); expect(testElements[0].text).toEqual('SUPER_AUTHOR'); });