it('Test 002 : should return new instance for every PluginManager.get call', function () { expect(PluginManager.get(FAKE_PLATFORM, FAKE_LOCATIONS)).toEqual(jasmine.any(PluginManager)); expect(PluginManager.get(FAKE_PLATFORM, FAKE_LOCATIONS)) .not.toBe(PluginManager.get(FAKE_PLATFORM, FAKE_LOCATIONS)); });
describe('parseElementtreeSync', function () { it('Test 001 : should parse xml with a byte order mark', function () { const xml_path = path.join(__dirname, '../fixtures/projects/windows-bom-test.xml'); expect(function () { xml_helpers.parseElementtreeSync(xml_path); }).not.toThrow(); }); });
describe('DesktopLauncher', () => { let instance let node beforeEach(() => { node = document.createElement('div') instance = new DesktopLauncher() instance.renderTo(node, {history}) }) it('is not empty', () => { expect(node).not.toBeEmpty() }) })
it('Test 017 : should not call graftXML for a config munge targeting a config file that does not exist', function () { const platformJson = PlatformJson.load(plugins_dir, 'android'); platformJson.addInstalledPluginToPrepareQueue('org.test.plugins.dummyplugin', {}); const spy = spyOn(fs, 'readFileSync').and.callThrough(); const munger = new configChanges.PlatformMunger('android', temp, platformJson, pluginInfoProvider); munger.process(plugins_dir); expect(spy).not.toHaveBeenCalledWith(path.join(temp, 'res', 'xml', 'plugins.xml'), 'utf-8'); });
it('Test 030 : it should remove given plugin', function () { cfg.removePlugin('org.apache.cordova.justaplugin'); const plugins = cfg.doc.findall('plugin'); const pluginNames = plugins.map(function (plugin) { return plugin.attrib.name; }); expect(pluginNames).not.toContain('org.apache.cordova.justaplugin'); });
it("should set logger on creation", () => { expect(() => TargetClient.create({ client: "client", organizationId: "orgId", logger: testLogger }) ).not.toThrow(); expect(utils.getLogger.calls.any()).toBe(true); const logger = utils.getLogger.calls.mostRecent().returnValue; expect(logger.debug).toEqual(jasmine.any(Function)); expect(logger.error).toEqual(jasmine.any(Function)); });
it('Test 034 : it should read <allow-intent> tag entries', function () { const intents = cfg.getAllowIntents(); expect(intents.length).not.toEqual(0); });
describe('PluginInfoProvider', function () { describe('getAllWithinSearchPath', function () { it('Test 001 : should load all plugins in a dir', function () { const pluginInfoProvider = new PluginInfoProvider(); const plugins = pluginInfoProvider.getAllWithinSearchPath(pluginsDir); expect(plugins.length).not.toBe(0); expect(plugins).toContain(jasmine.objectContaining({ id: 'org.test.scoped', dir: path.join(pluginsDir, '@scope/test') })); }); }); });
it('Test 009 : should not use xml comments as config munge leaves', function () { const munger = new configChanges.PlatformMunger('android', temp, 'unused', null, pluginInfoProvider); const munge = munger.generate_plugin_config_munge(pluginInfoProvider.get(childrenplugin), {}); expect(get_munge_change(munge, 'AndroidManifest.xml', '/manifest', '<!--library-->')).not.toBeDefined(); expect(get_munge_change(munge, 'AndroidManifest.xml', '/manifest', '<!-- GCM connects to Google Services. -->')).not.toBeDefined(); });
describe('validateJSON', function () { const schema = require('./fixtures/testSchema.json'); it('returns gracefully if object is valid for a given schema', function () { expect(function () { sut.validateJSON({ firstName: 'John', lastName: 'Doe' }, schema); }).not.toThrow(); }); it('throws an error if object is not valid', function () { expect(function () { sut.validateJSON({ firstName: 'John' }, schema); }).toThrow(); }); });
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(); });
describe('RootContainer', () => { let instance beforeEach(() => { instance = TestUtils.renderIntoDocument( <RootContainer history={history} /> ) }) it('is not empty', () => { let node = React.findDOMNode(instance) expect(node).not.toBeEmpty() }) })
it("should not throw when client and orgId are present", () => { expect(() => TargetClient.create({ client: "client", organizationId: "orgId" }) ).not.toThrow(); });
it('Test 036: it should read <config-file> tag entries', function () { const configFiles = cfg.getConfigFiles('android'); expect(configFiles.length).not.toEqual(0); });
it('Test 031 : it should remove given legacy feature id', function () { cfg.removePlugin('org.apache.cordova.legacyplugin'); const plugins = cfg.doc.findall('feature'); const pluginNames = plugins.map(function (plugin) { return plugin.attrib.name; }); expect(pluginNames).not.toContain('org.apache.cordova.legacyplugin'); });